Spaces:
Running
on
A10G
Running
on
A10G
Linoy Tsaban
commited on
Commit
·
5eb5476
1
Parent(s):
b2af899
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def invert(x0, prompt_src="", num_diffusion_steps=100, cfg_scale_src = 3.5, eta
|
|
| 27 |
w0 = (sd_pipe.vae.encode(x0).latent_dist.mode() * 0.18215).float()
|
| 28 |
|
| 29 |
# find Zs and wts - forward process
|
| 30 |
-
wt, zs, wts = inversion_forward_process(sd_pipe, w0, etas=eta, prompt=prompt_src, cfg_scale=cfg_scale_src, prog_bar=
|
| 31 |
return wt, zs, wts
|
| 32 |
|
| 33 |
|
|
@@ -194,17 +194,19 @@ with gr.Blocks() as demo:
|
|
| 194 |
with gr.Row():
|
| 195 |
input_image = gr.Image(label="Input Image", interactive=True)
|
| 196 |
input_image.style(height=512, width=512)
|
| 197 |
-
inverted_image = gr.Image(label=f"Reconstructed Image", interactive=False)
|
| 198 |
-
inverted_image.style(height=512, width=512)
|
| 199 |
output_image = gr.Image(label=f"Edited Image", interactive=False)
|
| 200 |
output_image.style(height=512, width=512)
|
| 201 |
|
| 202 |
|
| 203 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
with gr.Column(scale=1, min_width=100):
|
| 205 |
-
|
| 206 |
-
with gr.Column(scale=1, min_width=100):
|
| 207 |
-
edit_button = gr.Button("Edit")
|
| 208 |
|
| 209 |
|
| 210 |
with gr.Accordion("Advanced Options", open=False):
|
|
@@ -231,23 +233,23 @@ with gr.Blocks() as demo:
|
|
| 231 |
|
| 232 |
# gr.Markdown(help_text)
|
| 233 |
|
| 234 |
-
invert_button.click(
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
)
|
| 251 |
|
| 252 |
edit_button.click(
|
| 253 |
fn=edit,
|
|
|
|
| 27 |
w0 = (sd_pipe.vae.encode(x0).latent_dist.mode() * 0.18215).float()
|
| 28 |
|
| 29 |
# find Zs and wts - forward process
|
| 30 |
+
wt, zs, wts = inversion_forward_process(sd_pipe, w0, etas=eta, prompt=prompt_src, cfg_scale=cfg_scale_src, prog_bar=False, num_inference_steps=num_diffusion_steps)
|
| 31 |
return wt, zs, wts
|
| 32 |
|
| 33 |
|
|
|
|
| 194 |
with gr.Row():
|
| 195 |
input_image = gr.Image(label="Input Image", interactive=True)
|
| 196 |
input_image.style(height=512, width=512)
|
| 197 |
+
# inverted_image = gr.Image(label=f"Reconstructed Image", interactive=False)
|
| 198 |
+
# inverted_image.style(height=512, width=512)
|
| 199 |
output_image = gr.Image(label=f"Edited Image", interactive=False)
|
| 200 |
output_image.style(height=512, width=512)
|
| 201 |
|
| 202 |
|
| 203 |
with gr.Row():
|
| 204 |
+
# with gr.Column(scale=1, min_width=100):
|
| 205 |
+
# invert_button = gr.Button("Invert")
|
| 206 |
+
# with gr.Column(scale=1, min_width=100):
|
| 207 |
+
# edit_button = gr.Button("Edit")
|
| 208 |
with gr.Column(scale=1, min_width=100):
|
| 209 |
+
edit_button = gr.Button("Run")
|
|
|
|
|
|
|
| 210 |
|
| 211 |
|
| 212 |
with gr.Accordion("Advanced Options", open=False):
|
|
|
|
| 233 |
|
| 234 |
# gr.Markdown(help_text)
|
| 235 |
|
| 236 |
+
# invert_button.click(
|
| 237 |
+
# fn=edit,
|
| 238 |
+
# inputs=[input_image,
|
| 239 |
+
# src_prompt,
|
| 240 |
+
# src_prompt,
|
| 241 |
+
# steps,
|
| 242 |
+
# cfg_scale_src,
|
| 243 |
+
# cfg_scale_tar,
|
| 244 |
+
# skip,
|
| 245 |
+
# seed,
|
| 246 |
+
# left,
|
| 247 |
+
# right,
|
| 248 |
+
# top,
|
| 249 |
+
# bottom
|
| 250 |
+
# ],
|
| 251 |
+
# outputs = [inverted_image],
|
| 252 |
+
# )
|
| 253 |
|
| 254 |
edit_button.click(
|
| 255 |
fn=edit,
|