Spaces:
Sleeping
Sleeping
oyly
commited on
Commit
·
c8919af
1
Parent(s):
0123c32
fix: inverse and steps
Browse files
app.py
CHANGED
|
@@ -34,7 +34,7 @@ class FluxEditor_lore_demo:
|
|
| 34 |
|
| 35 |
self.name = model_name
|
| 36 |
self.is_schnell = model_name == "flux-schnell"
|
| 37 |
-
self.resize_longside =
|
| 38 |
self.save = False
|
| 39 |
|
| 40 |
self.output_dir = 'outputs_gradio'
|
|
@@ -136,7 +136,7 @@ class FluxEditor_lore_demo:
|
|
| 136 |
print(f"inversion Done in {t1 - t0:.1f}s.")
|
| 137 |
return init_image
|
| 138 |
|
| 139 |
-
@spaces.GPU(duration=
|
| 140 |
def edit(self, brush_canvas, source_prompt, inversion_guidance,
|
| 141 |
target_prompt, target_object,target_object_index,
|
| 142 |
inversion_num_steps, injection_num_steps,
|
|
@@ -145,11 +145,9 @@ class FluxEditor_lore_demo:
|
|
| 145 |
):
|
| 146 |
|
| 147 |
torch.cuda.empty_cache()
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
inversion_num_steps, injection_num_steps,
|
| 152 |
-
inversion_guidance)
|
| 153 |
|
| 154 |
rgba_init_image = brush_canvas["background"]
|
| 155 |
rgba_mask = brush_canvas["layers"][0]
|
|
@@ -291,13 +289,13 @@ def create_demo(model_name: str):
|
|
| 291 |
<b>Here are editing steps:</b> <br>
|
| 292 |
1️⃣ Upload your source image. <br>
|
| 293 |
2️⃣ Fill in your source prompt and use the brush tool to draw your mask. (on layer 1) <br>
|
| 294 |
-
3️⃣ Fill in your target prompt, target object and its index in target prompt (index start from 0).
|
| 295 |
4️⃣ Adjust the hyperparameters. <br>
|
| 296 |
5️⃣ Click the "Edit" button to generate your edited image! <br>
|
| 297 |
|
| 298 |
🎨 [<b>Examples</b>] Click our examples below, draw your mask and click the "Edit" button. <br>
|
| 299 |
|
| 300 |
-
🔔 [<b>Note</b>] Due to limited resources, we will resize image to <=
|
| 301 |
go to https://github.com/oyly16/LORE for more usage. <br>
|
| 302 |
"""
|
| 303 |
article = r"""
|
|
|
|
| 34 |
|
| 35 |
self.name = model_name
|
| 36 |
self.is_schnell = model_name == "flux-schnell"
|
| 37 |
+
self.resize_longside = 512
|
| 38 |
self.save = False
|
| 39 |
|
| 40 |
self.output_dir = 'outputs_gradio'
|
|
|
|
| 136 |
print(f"inversion Done in {t1 - t0:.1f}s.")
|
| 137 |
return init_image
|
| 138 |
|
| 139 |
+
@spaces.GPU(duration=60)
|
| 140 |
def edit(self, brush_canvas, source_prompt, inversion_guidance,
|
| 141 |
target_prompt, target_object,target_object_index,
|
| 142 |
inversion_num_steps, injection_num_steps,
|
|
|
|
| 145 |
):
|
| 146 |
|
| 147 |
torch.cuda.empty_cache()
|
| 148 |
+
self.inverse(brush_canvas,source_prompt,
|
| 149 |
+
inversion_num_steps, injection_num_steps,
|
| 150 |
+
inversion_guidance)
|
|
|
|
|
|
|
| 151 |
|
| 152 |
rgba_init_image = brush_canvas["background"]
|
| 153 |
rgba_mask = brush_canvas["layers"][0]
|
|
|
|
| 289 |
<b>Here are editing steps:</b> <br>
|
| 290 |
1️⃣ Upload your source image. <br>
|
| 291 |
2️⃣ Fill in your source prompt and use the brush tool to draw your mask. (on layer 1) <br>
|
| 292 |
+
3️⃣ Fill in your target prompt, target object and its index in target prompt (index start from 0). <br>
|
| 293 |
4️⃣ Adjust the hyperparameters. <br>
|
| 294 |
5️⃣ Click the "Edit" button to generate your edited image! <br>
|
| 295 |
|
| 296 |
🎨 [<b>Examples</b>] Click our examples below, draw your mask and click the "Edit" button. <br>
|
| 297 |
|
| 298 |
+
🔔 [<b>Note</b>] Due to limited resources, we will resize image to <=512 longside. <br>
|
| 299 |
go to https://github.com/oyly16/LORE for more usage. <br>
|
| 300 |
"""
|
| 301 |
article = r"""
|