Linoy Tsaban commited on
Commit
5d818c6
1 Parent(s): 0e70f76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -103,7 +103,8 @@ def load_and_invert(
103
  wts = gr.State(value=wts_tensor)
104
  zs = gr.State(value=zs_tensor)
105
  do_inversion = False
106
-
 
107
  return wts, zs, do_inversion
108
 
109
  ## SEGA ##
@@ -281,6 +282,12 @@ with gr.Blocks(css='style.css') as demo:
281
  do_inversion = True
282
  return do_inversion
283
 
 
 
 
 
 
 
284
 
285
  gr.HTML(intro)
286
  wts = gr.State()
@@ -299,6 +306,9 @@ with gr.Blocks(css='style.css') as demo:
299
  ddpm_edited_image.style(height=365, width=365)
300
  sega_edited_image.style(height=365, width=365)
301
 
 
 
 
302
  with gr.Tabs() as tabs:
303
  with gr.TabItem('1. Describe the desired output', id=0):
304
  with gr.Row().style(mobile_collapse=False, equal_height=True):
@@ -373,8 +383,8 @@ with gr.Blocks(css='style.css') as demo:
373
 
374
 
375
 
376
- with gr.Accordion("Help", open=False):
377
- gr.Markdown(help_text)
378
 
379
  caption_button.click(
380
  fn = caption_image,
@@ -447,7 +457,7 @@ with gr.Blocks(css='style.css') as demo:
447
  queue=False).then(
448
  fn = hide_reconstruction,
449
  outputs=[ddpm_edited_image],
450
- queue=False).then(
451
  fn=load_and_invert,
452
  inputs=[input_image,
453
  do_inversion,
@@ -461,7 +471,7 @@ with gr.Blocks(css='style.css') as demo:
461
  tar_cfg_scale,
462
  ],
463
  # outputs=[ddpm_edited_image, wts, zs, do_inversion],
464
- outputs=[wts, zs, do_inversion],
465
  )
466
 
467
  # Repeat inversion when these params are changed:
 
103
  wts = gr.State(value=wts_tensor)
104
  zs = gr.State(value=zs_tensor)
105
  do_inversion = False
106
+
107
+ inversion_progress = "Inversion compeleted!"
108
  return wts, zs, do_inversion
109
 
110
  ## SEGA ##
 
282
  do_inversion = True
283
  return do_inversion
284
 
285
+ def show_inversion_progress():
286
+ return inversion_progress.update(visible=True)
287
+
288
+ def hide_inversion_progress():
289
+ return inversion_progress.update(visible=False)
290
+
291
 
292
  gr.HTML(intro)
293
  wts = gr.State()
 
306
  ddpm_edited_image.style(height=365, width=365)
307
  sega_edited_image.style(height=365, width=365)
308
 
309
+ with gr.Row():
310
+ inversion_progress = gr.Textbox(visible=False)
311
+
312
  with gr.Tabs() as tabs:
313
  with gr.TabItem('1. Describe the desired output', id=0):
314
  with gr.Row().style(mobile_collapse=False, equal_height=True):
 
383
 
384
 
385
 
386
+ # with gr.Accordion("Help", open=False):
387
+ # gr.Markdown(help_text)
388
 
389
  caption_button.click(
390
  fn = caption_image,
 
457
  queue=False).then(
458
  fn = hide_reconstruction,
459
  outputs=[ddpm_edited_image],
460
+ queue=False).then(fn = show_inversion_progress, outputs=[inversion_progress]).then(
461
  fn=load_and_invert,
462
  inputs=[input_image,
463
  do_inversion,
 
471
  tar_cfg_scale,
472
  ],
473
  # outputs=[ddpm_edited_image, wts, zs, do_inversion],
474
+ outputs=[wts, zs, do_inversion, inversion_progress],
475
  )
476
 
477
  # Repeat inversion when these params are changed: