Spaces:
Runtime error
Runtime error
File size: 671 Bytes
f01e357 4b839be f01e357 69a8278 f01e357 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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() |