Spaces:
Paused
Paused
Download app.py from veltrixcode/retest: direct link, hf CLI and curl.
- Browser
- Download file 727 Bytes
-
https://huggingface.co/spaces/veltrixcode/retest/resolve/main/app.py
- Command line
-
hf download hf://spaces/veltrixcode/retest/app.py
-
curl -L -o app.py https://huggingface.co/spaces/veltrixcode/retest/resolve/main/app.py
727 Bytes
| from fastapi import FastAPI, Query | |
| from fastapi.responses import JSONResponse | |
| from gradio_client import Client | |
| import base64 | |
| import requests | |
| import tempfile | |
| import os | |
| app = FastAPI() | |
| client = Client("Qwen/Qwen-Image") | |
| def generate(prompt: str = Query(...)): | |
| result = client.predict( | |
| prompt=prompt, | |
| seed=0, | |
| randomize_seed=True, | |
| aspect_ratio="16:9", | |
| guidance_scale=4, | |
| num_inference_steps=50, | |
| prompt_enhance=True, | |
| api_name="/infer" | |
| ) | |
| img = result[0] # dict | |
| return { | |
| "prompt": prompt, | |
| "image_url": img.get("url"), | |
| "size": img.get("size"), | |
| "mime_type": img.get("mime_type") | |
| } | |