Spaces:
Sleeping
Sleeping
oyly commited on
Commit ·
66cc858
1
Parent(s): 8276952
only edit button
Browse files
app.py
CHANGED
|
@@ -82,7 +82,6 @@ class FluxEditor_lore_demo:
|
|
| 82 |
resized_pil = pil_mask.resize((width, height), Image.NEAREST) # width first!
|
| 83 |
return np.array(resized_pil)
|
| 84 |
|
| 85 |
-
@spaces.GPU(duration=120)
|
| 86 |
def inverse(self, brush_canvas,src_prompt,
|
| 87 |
inversion_num_steps, injection_num_steps,
|
| 88 |
inversion_guidance,
|
|
@@ -286,13 +285,15 @@ def create_demo(model_name: str):
|
|
| 286 |
<b>LORE: Latent Optimization for Precise Semantic Control in Rectified Flow-based Image Editing.</b><br>
|
| 287 |
<b>Here are editing steps:</b> <br>
|
| 288 |
1️⃣ Upload your source image. <br>
|
| 289 |
-
2️⃣ Fill in your source prompt and
|
| 290 |
-
3️⃣
|
| 291 |
-
4️⃣
|
| 292 |
5️⃣ Click the "Edit" button to generate your edited image! <br>
|
| 293 |
-
|
|
|
|
| 294 |
|
| 295 |
🔔 [<b>Note</b>] Due to limited resources, we will resize image to <=800 longside. <br>
|
|
|
|
| 296 |
"""
|
| 297 |
article = r"""
|
| 298 |
https://github.com/oyly16/LORE
|
|
@@ -318,7 +319,6 @@ def create_demo(model_name: str):
|
|
| 318 |
container=True,
|
| 319 |
format='png',scale=1)
|
| 320 |
|
| 321 |
-
inv_btn = gr.Button("inverse")
|
| 322 |
edit_btn = gr.Button("edit")
|
| 323 |
|
| 324 |
|
|
@@ -334,14 +334,6 @@ def create_demo(model_name: str):
|
|
| 334 |
|
| 335 |
output_image = gr.Image(label="Generated Image")
|
| 336 |
gr.Markdown(article)
|
| 337 |
-
inv_btn.click(
|
| 338 |
-
fn=editor.inverse,
|
| 339 |
-
inputs=[brush_canvas,src_prompt,
|
| 340 |
-
inversion_num_steps, injection_num_steps,
|
| 341 |
-
inversion_guidance,
|
| 342 |
-
],
|
| 343 |
-
outputs=[output_image]
|
| 344 |
-
)
|
| 345 |
edit_btn.click(
|
| 346 |
fn=editor.edit,
|
| 347 |
inputs=[brush_canvas,src_prompt,inversion_guidance,
|
|
|
|
| 82 |
resized_pil = pil_mask.resize((width, height), Image.NEAREST) # width first!
|
| 83 |
return np.array(resized_pil)
|
| 84 |
|
|
|
|
| 85 |
def inverse(self, brush_canvas,src_prompt,
|
| 86 |
inversion_num_steps, injection_num_steps,
|
| 87 |
inversion_guidance,
|
|
|
|
| 285 |
<b>LORE: Latent Optimization for Precise Semantic Control in Rectified Flow-based Image Editing.</b><br>
|
| 286 |
<b>Here are editing steps:</b> <br>
|
| 287 |
1️⃣ Upload your source image. <br>
|
| 288 |
+
2️⃣ Fill in your source prompt and use the brush tool to draw your mask. (on layer 1) <br>
|
| 289 |
+
3️⃣ Fill in your target prompt, target object and its index in target prompt (index start from 0).
|
| 290 |
+
4️⃣ Adjust the hyperparameters. <br>
|
| 291 |
5️⃣ Click the "Edit" button to generate your edited image! <br>
|
| 292 |
+
|
| 293 |
+
🎨 [<b>Examples</b>] Click our examples below, draw your mask and click the "Edit" button. <br>
|
| 294 |
|
| 295 |
🔔 [<b>Note</b>] Due to limited resources, we will resize image to <=800 longside. <br>
|
| 296 |
+
go to https://github.com/oyly16/LORE for more usage. <br>
|
| 297 |
"""
|
| 298 |
article = r"""
|
| 299 |
https://github.com/oyly16/LORE
|
|
|
|
| 319 |
container=True,
|
| 320 |
format='png',scale=1)
|
| 321 |
|
|
|
|
| 322 |
edit_btn = gr.Button("edit")
|
| 323 |
|
| 324 |
|
|
|
|
| 334 |
|
| 335 |
output_image = gr.Image(label="Generated Image")
|
| 336 |
gr.Markdown(article)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
edit_btn.click(
|
| 338 |
fn=editor.edit,
|
| 339 |
inputs=[brush_canvas,src_prompt,inversion_guidance,
|