Download app.py from Zeus1377/MIVA: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/spaces/Zeus1377/MIVA/resolve/main/app.py
- Command line
-
hf download hf://spaces/Zeus1377/MIVA/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Zeus1377/MIVA/resolve/main/app.py
708 Bytes
| import gradio as gr | |
| import spaces | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| MODEL = "Qwen/Qwen-Image" | |
| pipe = DiffusionPipeline.from_pretrained( | |
| MODEL, | |
| torch_dtype=torch.bfloat16 | |
| ) | |
| def generate(prompt): | |
| image = pipe( | |
| prompt=prompt, | |
| num_inference_steps=20, | |
| true_cfg_scale=4.0, | |
| width=1024, | |
| height=1024 | |
| ).images[0] | |
| return image | |
| demo = gr.Interface( | |
| fn=generate, | |
| inputs=gr.Textbox( | |
| label="Prompt", | |
| placeholder="A cinematic superhero standing on a skyscraper at night..." | |
| ), | |
| outputs=gr.Image(label="Generated Image"), | |
| title="MIVA 🖼️ AI Image Generator" | |
| ) | |
| demo.launch() |