Always same reponse?

I am using GPT2 for text generation.

However, for any given prompt, the response is always the same.

For example, for the prompt: ā€œThe answer to the universe isā€ ā€¦ the response is always: "The answer to the universe is not in the right directions to set an orbit around, but instead on a flat platform with plenty of space to spread Earthly planets and other planets. You still find the answer here at the end of the article of lifeā€¦

How can I change this each time I run my code?

import json
import requests
headers = {ā€œAuthorizationā€: f"Bearer MYAPI"}
API_URL = ā€œhttps://api-inference.huggingface.co/models/gpt2ā€

def query(payload):
data = json.dumps(payload)
response = requests.request(ā€œPOSTā€, API_URL, headers=headers, data=data)
return json.loads(response.content.decode(ā€œutf-8ā€))
data = query({ā€œinputsā€: ā€œThe answer to the universe isā€})

print(data[0][ā€˜generated_textā€™])

Up the question