Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -121,6 +121,10 @@ pipe.load_lora_weights("dx8152/Qwen-Image-Edit-2509-Fusion",
|
|
| 121 |
weight_name="溶图.safetensors",
|
| 122 |
adapter_name="fusion-x")
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
try:
|
| 125 |
pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
|
| 126 |
print("Flash Attention 3 Processor set successfully.")
|
|
@@ -174,12 +178,15 @@ def infer(
|
|
| 174 |
prompt = "Fuse object into background."
|
| 175 |
elif lora_adapter == "Super-Fusion":
|
| 176 |
prompt = "Blend the product into the background, correct its perspective and lighting, and make it naturally integrated with the scene."
|
|
|
|
|
|
|
| 177 |
|
| 178 |
adapters_map = {
|
| 179 |
"Texture Edit": "texture",
|
| 180 |
"Fuse-Objects": "fusion",
|
| 181 |
"Cloth-Design-Fuse": "shirt_design",
|
| 182 |
"Super-Fusion": "fusion-x",
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
active_adapter = adapters_map.get(lora_adapter)
|
|
@@ -268,7 +275,7 @@ with gr.Blocks() as demo:
|
|
| 268 |
with gr.Row():
|
| 269 |
lora_adapter = gr.Dropdown(
|
| 270 |
label="Choose Editing Style",
|
| 271 |
-
choices=["Texture Edit", "Cloth-Design-Fuse", "Fuse-Objects", "Super-Fusion"],
|
| 272 |
value="Texture Edit",
|
| 273 |
)
|
| 274 |
|
|
@@ -280,6 +287,7 @@ with gr.Blocks() as demo:
|
|
| 280 |
["examples/F3.jpg", "examples/F4.jpg", "Replace her glasses with the new glasses from image 1.", "Super-Fusion"],
|
| 281 |
["examples/F1.jpg", "examples/F2.jpg", "Put the small bottle on the table.", "Super-Fusion"],
|
| 282 |
["examples/Mug1.jpg", "examples/Texture1.jpg", "Apply the design from image 2 to the mug.", "Texture Edit"],
|
|
|
|
| 283 |
["examples/Cat1.jpg", "examples/Glass1.webp", "A cat wearing glasses in image 2.", "Fuse-Objects"],
|
| 284 |
|
| 285 |
],
|
|
|
|
| 121 |
weight_name="溶图.safetensors",
|
| 122 |
adapter_name="fusion-x")
|
| 123 |
|
| 124 |
+
pipe.load_lora_weights("oumoumad/Qwen-Edit-2509-Material-transfer",
|
| 125 |
+
weight_name="material-transfer_000004769.safetensors",
|
| 126 |
+
adapter_name="material-transfer")
|
| 127 |
+
|
| 128 |
try:
|
| 129 |
pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
|
| 130 |
print("Flash Attention 3 Processor set successfully.")
|
|
|
|
| 178 |
prompt = "Fuse object into background."
|
| 179 |
elif lora_adapter == "Super-Fusion":
|
| 180 |
prompt = "Blend the product into the background, correct its perspective and lighting, and make it naturally integrated with the scene."
|
| 181 |
+
elif lora_adapter == "Material-Transfer":
|
| 182 |
+
prompt = "change materials of image1 to match the reference in image2"
|
| 183 |
|
| 184 |
adapters_map = {
|
| 185 |
"Texture Edit": "texture",
|
| 186 |
"Fuse-Objects": "fusion",
|
| 187 |
"Cloth-Design-Fuse": "shirt_design",
|
| 188 |
"Super-Fusion": "fusion-x",
|
| 189 |
+
"Material-Transfer": "material-transfer",
|
| 190 |
}
|
| 191 |
|
| 192 |
active_adapter = adapters_map.get(lora_adapter)
|
|
|
|
| 275 |
with gr.Row():
|
| 276 |
lora_adapter = gr.Dropdown(
|
| 277 |
label="Choose Editing Style",
|
| 278 |
+
choices=["Texture Edit", "Cloth-Design-Fuse", "Fuse-Objects", "Super-Fusion", "Material-Transfer"],
|
| 279 |
value="Texture Edit",
|
| 280 |
)
|
| 281 |
|
|
|
|
| 287 |
["examples/F3.jpg", "examples/F4.jpg", "Replace her glasses with the new glasses from image 1.", "Super-Fusion"],
|
| 288 |
["examples/F1.jpg", "examples/F2.jpg", "Put the small bottle on the table.", "Super-Fusion"],
|
| 289 |
["examples/Mug1.jpg", "examples/Texture1.jpg", "Apply the design from image 2 to the mug.", "Texture Edit"],
|
| 290 |
+
["examples/Chair.jpg", "examples/Material.jpg", "Change materials of image1 to match the reference in image2.", "Material-Transfer"],
|
| 291 |
["examples/Cat1.jpg", "examples/Glass1.webp", "A cat wearing glasses in image 2.", "Fuse-Objects"],
|
| 292 |
|
| 293 |
],
|