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 ) @spaces.GPU(duration=120) 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()