Spaces:
Runtime error
Runtime error
| import gradio | |
| import requests | |
| import io | |
| from PIL import Image | |
| #define API URL, where we want to send request to | |
| #API token is used for acess | |
| from huggingface_hub import InferenceClient | |
| client = InferenceClient( | |
| provider="hf-inference", | |
| api_key="hf_#############" | |
| ) | |
| # output is a PIL.Image object | |
| image = client.text_to_image( | |
| "Astronaut riding a horse", | |
| model="sd-community/sdxl-flash" | |
| ) | |