Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -169,25 +169,31 @@ def edit(init_image, source_prompt, target_prompt, num_steps, inject_step, guida
|
|
| 169 |
|
| 170 |
def create_demo(model_name: str, device: str = "cuda:0" if torch.cuda.is_available() else "cpu", offload: bool = False):
|
| 171 |
is_schnell = model_name == "flux-schnell"
|
| 172 |
-
|
| 173 |
-
with gr.Blocks() as demo:
|
| 174 |
-
# gr.Markdown(f"# Official Demo for Taming Rectified Flow for Inversion and Editing")
|
| 175 |
-
title = r"""
|
| 176 |
<h1 align="center">Taming Rectified Flow for Inversion and Editing</h1>
|
| 177 |
"""
|
| 178 |
|
| 179 |
-
|
| 180 |
<b>Official 🤗 Gradio demo</b> for <a href='https://github.com/wangjiangshan0725/RF-Solver-Edit' target='_blank'><b>Taming Rectified Flow for Inversion and Editing</b></a>.<br>
|
| 181 |
|
| 182 |
❗️❗️❗️[<b>Important</b>] Editing steps:<br>
|
| 183 |
-
1️⃣ Upload images you want to edit (The resolution is expected be less than 1360*768, or the memory of GPU may be not enough.)
|
| 184 |
-
2️⃣ Enter the source prompt, which describes the content of the image you unload. The source prompt is not mandatory; you can also leave it to null.
|
| 185 |
-
3️⃣ Enter the target prompt which describes the content of the expected images after editing.
|
| 186 |
-
4️⃣ Click the <b>Generate</b> button to start editing.
|
| 187 |
5️⃣ We suggest to adjust the value of **feature sharing steps** for better results.
|
| 188 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
gr.Markdown(title)
|
| 190 |
gr.Markdown(description)
|
|
|
|
| 191 |
with gr.Row():
|
| 192 |
with gr.Column():
|
| 193 |
source_prompt = gr.Textbox(label="Source Prompt", value="")
|
|
@@ -228,6 +234,7 @@ def create_demo(model_name: str, device: str = "cuda:0" if torch.cuda.is_availab
|
|
| 228 |
inputs=[init_image, source_prompt, target_prompt, num_steps, inject_step, guidance],
|
| 229 |
outputs=[output_image]
|
| 230 |
)
|
|
|
|
| 231 |
|
| 232 |
|
| 233 |
return demo
|
|
|
|
| 169 |
|
| 170 |
def create_demo(model_name: str, device: str = "cuda:0" if torch.cuda.is_available() else "cpu", offload: bool = False):
|
| 171 |
is_schnell = model_name == "flux-schnell"
|
| 172 |
+
title = r"""
|
|
|
|
|
|
|
|
|
|
| 173 |
<h1 align="center">Taming Rectified Flow for Inversion and Editing</h1>
|
| 174 |
"""
|
| 175 |
|
| 176 |
+
description = r"""
|
| 177 |
<b>Official 🤗 Gradio demo</b> for <a href='https://github.com/wangjiangshan0725/RF-Solver-Edit' target='_blank'><b>Taming Rectified Flow for Inversion and Editing</b></a>.<br>
|
| 178 |
|
| 179 |
❗️❗️❗️[<b>Important</b>] Editing steps:<br>
|
| 180 |
+
1️⃣ Upload images you want to edit (The resolution is expected be less than 1360*768, or the memory of GPU may be not enough.)
|
| 181 |
+
2️⃣ Enter the source prompt, which describes the content of the image you unload. The source prompt is not mandatory; you can also leave it to null.
|
| 182 |
+
3️⃣ Enter the target prompt which describes the content of the expected images after editing.
|
| 183 |
+
4️⃣ Click the <b>Generate</b> button to start editing.
|
| 184 |
5️⃣ We suggest to adjust the value of **feature sharing steps** for better results.
|
| 185 |
"""
|
| 186 |
+
article = r"""
|
| 187 |
+
If our work is helpful, please help to ⭐ the <a href='https://github.com/wangjiangshan0725/RF-Solver-Edit' target='_blank'>Github Repo</a>. Thanks!
|
| 188 |
+
[](https://github.com/wangjiangshan0725/RF-Solver-Edit)
|
| 189 |
+
---
|
| 190 |
+
"""
|
| 191 |
+
with gr.Blocks() as demo:
|
| 192 |
+
# gr.Markdown(f"# Official Demo for Taming Rectified Flow for Inversion and Editing")
|
| 193 |
+
|
| 194 |
gr.Markdown(title)
|
| 195 |
gr.Markdown(description)
|
| 196 |
+
|
| 197 |
with gr.Row():
|
| 198 |
with gr.Column():
|
| 199 |
source_prompt = gr.Textbox(label="Source Prompt", value="")
|
|
|
|
| 234 |
inputs=[init_image, source_prompt, target_prompt, num_steps, inject_step, guidance],
|
| 235 |
outputs=[output_image]
|
| 236 |
)
|
| 237 |
+
gr.Markdown(article)
|
| 238 |
|
| 239 |
|
| 240 |
return demo
|