Randomness in Inference API outputs
When I use it with Inference API, I always get the same output if the prompt is same. However, if I enter same prompts in this web inference and compute, I get random images everytime.
How can I seed the output using python api?
code:
import requests
import io,os
from PIL import Image
API_URL = "https://api-inference.huggingface.co/models/gsdf/Counterfeit-V2.5"
headers = {"Authorization": "Bearer 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"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
prompt=input("Prompt: ")
count=10
if count>1:
os.mkdir(prompt)
for f in range(count):
image_bytes = query({"inputs": prompt})
image = Image.open(io.BytesIO(image_bytes))
if count==1:
image.save("%s.png"%(prompt))
elif count>1:
image.save("%s/%d.png"%(prompt,f+1))