Spaces:
Runtime error
Runtime error
Download app.py from BlueBuff/BlueBuff-Image-Edits: direct link, hf CLI and curl.
- Browser
- Download file 671 Bytes
-
https://huggingface.co/spaces/BlueBuff/BlueBuff-Image-Edits/resolve/main/app.py
- Command line
-
hf download hf://spaces/BlueBuff/BlueBuff-Image-Edits/app.py
-
curl -L -o app.py https://huggingface.co/spaces/BlueBuff/BlueBuff-Image-Edits/resolve/main/app.py
671 Bytes
| import gradio as gr | |
| import torch | |
| from diffusers import AutoPipelineForImage2Image | |
| model_id = "Qwen/Qwen-Image-Edit-2511" | |
| pipe = AutoPipelineForImage2Image.from_pretrained( | |
| model_id, | |
| torch_dtype=torch.float16 | |
| ).to("cpu") | |
| def edit(image, prompt): | |
| w, h = image.size | |
| image = image.resize((w, h)) | |
| result = pipe( | |
| prompt=prompt, | |
| image=image, | |
| strength=0.65, | |
| num_inference_steps=4 # FAST MODE | |
| ).images[0] | |
| return result | |
| gr.Interface( | |
| fn=edit, | |
| inputs=[ | |
| gr.Image(type="pil"), | |
| gr.Textbox(label="Prompt edit") | |
| ], | |
| outputs="image", | |
| title="My AI Image Editor (4 Steps Fast)" | |
| ).launch() |