Fabrice-TIERCELIN commited on
Commit
950e888
·
verified ·
1 Parent(s): 90895c2

Your computer must not enter into standby mode

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -99,9 +99,10 @@ def reset():
99
  6
100
  ]
101
 
102
- def check(input_image):
103
  if input_image is None:
104
  raise gr.Error("Please provide an image to restore.")
 
105
 
106
  @spaces.GPU(duration=420)
107
  def stage1_process(
@@ -610,6 +611,7 @@ with gr.Blocks() as interface:
610
  diffusion_button = gr.Button(value="🚀 Upscale/Restore", variant = "primary", elem_id = "process_button")
611
  reset_btn = gr.Button(value="🧹 Reinit page", variant="stop", elem_id="reset_button", visible = False)
612
 
 
613
  restore_information = gr.HTML(value = "Restart the process to get another result.", visible = False)
614
  result_slider = ImageSlider(label = 'Comparator', show_label = False, interactive = False, elem_id = "slider1", show_download_button = False)
615
  result_gallery = gr.Gallery(label = 'Downloadable results', show_label = True, interactive = False, elem_id = "gallery1")
@@ -627,7 +629,7 @@ with gr.Blocks() as interface:
627
  1024,
628
  1,
629
  8,
630
- 200,
631
  -1,
632
  1,
633
  7.5,
@@ -792,9 +794,9 @@ with gr.Blocks() as interface:
792
  rotation
793
  ], queue = False, show_progress = False)
794
 
795
- denoise_button.click(fn = check, inputs = [
796
  input_image
797
- ], outputs = [], queue = False, show_progress = False).success(fn = stage1_process, inputs = [
798
  input_image,
799
  gamma_correction,
800
  diff_dtype,
@@ -809,9 +811,9 @@ with gr.Blocks() as interface:
809
  seed
810
  ], outputs = [
811
  seed
812
- ], queue = False, show_progress = False).then(fn = check, inputs = [
813
  input_image
814
- ], outputs = [], queue = False, show_progress = False).success(fn=stage2_process, inputs = [
815
  input_image,
816
  rotation,
817
  denoise_image,
 
99
  6
100
  ]
101
 
102
+ def check_and_update(input_image):
103
  if input_image is None:
104
  raise gr.Error("Please provide an image to restore.")
105
+ return gr.update(visible = True)
106
 
107
  @spaces.GPU(duration=420)
108
  def stage1_process(
 
611
  diffusion_button = gr.Button(value="🚀 Upscale/Restore", variant = "primary", elem_id = "process_button")
612
  reset_btn = gr.Button(value="🧹 Reinit page", variant="stop", elem_id="reset_button", visible = False)
613
 
614
+ warning = gr.HTML(value = "<center><big>Your computer must <u>not</u> enter into standby mode.</big><br/>On Chrome, you can force to keep a tab alive in <code>chrome://discards/</code></center>", visible = False)
615
  restore_information = gr.HTML(value = "Restart the process to get another result.", visible = False)
616
  result_slider = ImageSlider(label = 'Comparator', show_label = False, interactive = False, elem_id = "slider1", show_download_button = False)
617
  result_gallery = gr.Gallery(label = 'Downloadable results', show_label = True, interactive = False, elem_id = "gallery1")
 
629
  1024,
630
  1,
631
  8,
632
+ 100,
633
  -1,
634
  1,
635
  7.5,
 
794
  rotation
795
  ], queue = False, show_progress = False)
796
 
797
+ denoise_button.click(fn = check_and_update, inputs = [
798
  input_image
799
+ ], outputs = [warning], queue = False, show_progress = False).success(fn = stage1_process, inputs = [
800
  input_image,
801
  gamma_correction,
802
  diff_dtype,
 
811
  seed
812
  ], outputs = [
813
  seed
814
+ ], queue = False, show_progress = False).then(fn = check_and_update, inputs = [
815
  input_image
816
+ ], outputs = [warning], queue = False, show_progress = False).success(fn=stage2_process, inputs = [
817
  input_image,
818
  rotation,
819
  denoise_image,