Spaces:
Runtime error
Runtime error
File size: 520 Bytes
a7f4491 e60c854 98c8800 e60c854 a7f4491 8fcb46d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
import io
from PIL import Image
API_URL = "https://api-inference.huggingface.co/models/hc1608/diffusion"
headers = {"Authorization": "Bearer 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"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
image_bytes = response.content
image = Image.open(io.BytesIO(image_bytes))
return image
demo = gr.Interface(fn=query, inputs="text", outputs="image")
if __name__ == "__main__":
demo.launch(debug = True) |