Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from diffusers import DiffusionPipeline | |
| import torch | |
| from PIL import Image | |
| # Base + LoRA | |
| BASE_MODEL = "Qwen/Qwen-Image-Edit-2509" | |
| LORA_PATH = "dx8152/Qwen-Image-Edit-2509-Light_restoration" | |
| pipe = DiffusionPipeline.from_pretrained(BASE_MODEL, torch_dtype=torch.float16).to("cuda") | |
| pipe.load_lora_weights(LORA_PATH) | |
| def edit_image(prompt, input_image): | |
| result = pipe(prompt=prompt, image=input_image).images[0] | |
| return result | |
| demo = gr.Interface( | |
| fn=edit_image, | |
| inputs=[gr.Textbox(label="Prompt"), gr.Image(label="Input Image")], | |
| outputs=gr.Image(label="Output Image"), | |
| title="Qwen Image Edit – Light Restoration" | |
| ) | |
| demo.launch() | |