| import torch | |
| from diffusers import DiffusionPipeline | |
| from diffusers.utils import load_image | |
| # Switch to "mps" for Apple devices | |
| pipe = DiffusionPipeline.from_pretrained( | |
| "Qwen/Qwen-Image-Edit-2511", | |
| dtype=torch.bfloat16, | |
| device_map="cuda" | |
| ) | |
| pipe.load_lora_weights("prithivMLmods/Qwen-Image-Edit-2511-Unblur-Upscale") | |
| prompt = "unblur and upscale to high resolution preserving sharp details natural textures and realistic colors" | |
| input_image = load_image( | |
| "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png" | |
| ) | |
| image = pipe(image=input_image, prompt=prompt).images[0] | |