Spaces:
Running
on
A10G
Running
on
A10G
Linoy Tsaban
commited on
Commit
•
d76aee0
1
Parent(s):
8575e70
Update app.py
Browse files
app.py
CHANGED
@@ -193,7 +193,7 @@ def edit(input_image,
|
|
193 |
num_images_per_prompt=1,
|
194 |
num_inference_steps=steps,
|
195 |
use_ddpm=True, wts=wts.value, zs=zs.value[skip:], **editing_args)
|
196 |
-
return sega_out.images[0]
|
197 |
|
198 |
|
199 |
|
@@ -256,8 +256,11 @@ with gr.Blocks(css='style.css') as demo:
|
|
256 |
else:
|
257 |
return row2.update(visible=True), row3.update(visible=True), plus.update(visible=False), 3
|
258 |
|
259 |
-
def
|
260 |
return reconstruct_button.update(visible=True)
|
|
|
|
|
|
|
261 |
|
262 |
def show_reconstruction():
|
263 |
return ddpm_edited_image.update(visible=True)
|
@@ -273,7 +276,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
273 |
zs = gr.State()
|
274 |
do_inversion = gr.State(value=True)
|
275 |
sega_concepts_counter = gr.State(1)
|
276 |
-
|
277 |
|
278 |
|
279 |
|
@@ -341,9 +344,8 @@ with gr.Blocks(css='style.css') as demo:
|
|
341 |
|
342 |
|
343 |
with gr.Row():
|
344 |
-
|
345 |
-
|
346 |
-
reconstruct_button = gr.Button("Show me the reconstruction", visible=False)
|
347 |
|
348 |
with gr.Accordion("Advanced Options", open=False):
|
349 |
with gr.Row():
|
@@ -401,9 +403,9 @@ with gr.Blocks(css='style.css') as demo:
|
|
401 |
threshold_1, threshold_2, threshold_3
|
402 |
|
403 |
],
|
404 |
-
outputs=[sega_edited_image],
|
405 |
).success(
|
406 |
-
fn =
|
407 |
outputs = [reconstruct_button]
|
408 |
)
|
409 |
|
@@ -423,8 +425,11 @@ with gr.Blocks(css='style.css') as demo:
|
|
423 |
# Automatically start inverting upon input_image change
|
424 |
input_image.change(
|
425 |
fn = reset_do_inversion,
|
426 |
-
outputs = [do_inversion],
|
427 |
-
|
|
|
|
|
|
|
428 |
fn=load_and_invert,
|
429 |
inputs=[input_image,
|
430 |
do_inversion,
|
|
|
193 |
num_images_per_prompt=1,
|
194 |
num_inference_steps=steps,
|
195 |
use_ddpm=True, wts=wts.value, zs=zs.value[skip:], **editing_args)
|
196 |
+
return sega_out.images[0], True
|
197 |
|
198 |
|
199 |
|
|
|
256 |
else:
|
257 |
return row2.update(visible=True), row3.update(visible=True), plus.update(visible=False), 3
|
258 |
|
259 |
+
def show_reconstruction_button():
|
260 |
return reconstruct_button.update(visible=True)
|
261 |
+
|
262 |
+
def hide_reconstruction_button():
|
263 |
+
return reconstruct_button.update(visible=False)
|
264 |
|
265 |
def show_reconstruction():
|
266 |
return ddpm_edited_image.update(visible=True)
|
|
|
276 |
zs = gr.State()
|
277 |
do_inversion = gr.State(value=True)
|
278 |
sega_concepts_counter = gr.State(1)
|
279 |
+
|
280 |
|
281 |
|
282 |
|
|
|
344 |
|
345 |
|
346 |
with gr.Row():
|
347 |
+
run_button = gr.Button("Run")
|
348 |
+
reconstruct_button = gr.Button("Show Reconstruction", visible=False)
|
|
|
349 |
|
350 |
with gr.Accordion("Advanced Options", open=False):
|
351 |
with gr.Row():
|
|
|
403 |
threshold_1, threshold_2, threshold_3
|
404 |
|
405 |
],
|
406 |
+
outputs=[sega_edited_image, is_show_reconstruction],
|
407 |
).success(
|
408 |
+
fn = show_reconstruction_button,
|
409 |
outputs = [reconstruct_button]
|
410 |
)
|
411 |
|
|
|
425 |
# Automatically start inverting upon input_image change
|
426 |
input_image.change(
|
427 |
fn = reset_do_inversion,
|
428 |
+
outputs = [do_inversion],
|
429 |
+
queue = False).then(
|
430 |
+
fn = hide_reconstruction_button,
|
431 |
+
outputs = [reconstruct_button],
|
432 |
+
queue=False).then(
|
433 |
fn=load_and_invert,
|
434 |
inputs=[input_image,
|
435 |
do_inversion,
|