Spaces:
Runtime error
Runtime error
Download app.py from florafeng/UCLIP-Image-Generator-APP: direct link, hf CLI and curl.
- Browser
- Download file 920 Bytes
-
https://huggingface.co/spaces/florafeng/UCLIP-Image-Generator-APP/resolve/main/app.py
- Command line
-
hf download hf://spaces/florafeng/UCLIP-Image-Generator-APP/app.py
-
curl -L -o app.py https://huggingface.co/spaces/florafeng/UCLIP-Image-Generator-APP/resolve/main/app.py
920 Bytes
| import gradio as gr | |
| from gradio_client import Client | |
| # 🔴 Replace with your backend Space URL | |
| BACKEND_URL = "https://florafeng-uclip-img-gen.hf.space" | |
| client = Client(BACKEND_URL) | |
| def generate(prompt, seed): | |
| try: | |
| result = client.predict( | |
| prompt, | |
| seed, | |
| api_name="/predict" # default for gr.Interface | |
| ) | |
| return result | |
| except Exception as e: | |
| return f"Error: {str(e)}" | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 🎨 AI Bedroom Generator") | |
| with gr.Row(): | |
| prompt = gr.Textbox( | |
| label="Prompt", | |
| value="a unique bedroom with dolls, pillows, paintings" | |
| ) | |
| seed = gr.Number(value=123, label="Seed") | |
| btn = gr.Button("Generate") | |
| output = gr.Image(label="Generated Image") | |
| btn.click( | |
| fn=generate, | |
| inputs=[prompt, seed], | |
| outputs=output | |
| ) | |
| demo.launch() |