Spaces:
Runtime error
Runtime error
| 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) |