Linoy Tsaban commited on
Commit
fd0f11a
1 Parent(s): c78a44c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -269,14 +269,17 @@ with gr.Blocks(css='style.css') as demo:
269
  def show_reconstruction_button():
270
  return reconstruct_button.update(visible=True)
271
 
272
- def hide_reconstruction_button():
273
- return reconstruct_button.update(visible=False)
274
 
275
  def show_reconstruction():
276
  return ddpm_edited_image.update(visible=True)
277
 
278
  def hide_reconstruction():
279
  return ddpm_edited_image.update(visible=False)
 
 
 
280
 
281
  def reset_do_inversion():
282
  do_inversion = True
@@ -368,6 +371,7 @@ with gr.Blocks(css='style.css') as demo:
368
  caption_button = gr.Button("Caption Image")
369
  run_button = gr.Button("Run")
370
  reconstruct_button = gr.Button("Show Reconstruction", visible=False)
 
371
 
372
  with gr.Accordion("Advanced Options", open=False):
373
  with gr.Row():
@@ -452,8 +456,8 @@ with gr.Blocks(css='style.css') as demo:
452
  fn = reset_do_inversion,
453
  outputs = [do_inversion],
454
  queue = False).then(
455
- fn = hide_reconstruction_button,
456
- outputs = [reconstruct_button],
457
  queue=False).then(
458
  fn = hide_reconstruction,
459
  outputs=[ddpm_edited_image],
@@ -474,6 +478,9 @@ with gr.Blocks(css='style.css') as demo:
474
  outputs=[wts, zs, do_inversion, inversion_progress],
475
  ).then(fn = hide_inversion_progress, outputs=[inversion_progress],queue=False)
476
 
 
 
 
477
  # Repeat inversion when these params are changed:
478
  src_prompt.change(
479
  fn = reset_do_inversion,
 
269
  def show_reconstruction_button():
270
  return reconstruct_button.update(visible=True)
271
 
272
+ def hide_reconstruction_buttons():
273
+ return reconstruct_button.update(visible=False), hide_reconstruct_button.update(visible=False)
274
 
275
  def show_reconstruction():
276
  return ddpm_edited_image.update(visible=True)
277
 
278
  def hide_reconstruction():
279
  return ddpm_edited_image.update(visible=False)
280
+
281
+ def show_hide_reconstruction_button():
282
+ return reconstruct_button.update(visible=False), hide_reconstruct_button.update(visible=True)
283
 
284
  def reset_do_inversion():
285
  do_inversion = True
 
371
  caption_button = gr.Button("Caption Image")
372
  run_button = gr.Button("Run")
373
  reconstruct_button = gr.Button("Show Reconstruction", visible=False)
374
+ hide_reconstruct_button = gr.Button("Hide Reconstruction", visible=False)
375
 
376
  with gr.Accordion("Advanced Options", open=False):
377
  with gr.Row():
 
456
  fn = reset_do_inversion,
457
  outputs = [do_inversion],
458
  queue = False).then(
459
+ fn = hide_reconstruction_buttons,
460
+ outputs = [reconstruct_button, hide_reconstruct_button],
461
  queue=False).then(
462
  fn = hide_reconstruction,
463
  outputs=[ddpm_edited_image],
 
478
  outputs=[wts, zs, do_inversion, inversion_progress],
479
  ).then(fn = hide_inversion_progress, outputs=[inversion_progress],queue=False)
480
 
481
+
482
+ ddpm_edited_image.change(fn = show_hide_reconstruction_button, outputs =[reconstruct_button, hide_reconstruct_button])
483
+
484
  # Repeat inversion when these params are changed:
485
  src_prompt.change(
486
  fn = reset_do_inversion,