Fabrice-TIERCELIN commited on
Commit
84dd386
1 Parent(s): c8547f4

Only one result can be shown in the slider

Browse files
Files changed (1) hide show
  1. gradio_demo.py +7 -6
gradio_demo.py CHANGED
@@ -28,7 +28,7 @@ parser.add_argument("--opt", type=str, default='options/SUPIR_v0.yaml')
28
  parser.add_argument("--ip", type=str, default='127.0.0.1')
29
  parser.add_argument("--port", type=int, default='6688')
30
  parser.add_argument("--no_llava", action='store_true', default=True)#False
31
- parser.add_argument("--use_image_slider", action='store_true', default=True)#False
32
  parser.add_argument("--log_history", action='store_true', default=False)
33
  parser.add_argument("--loading_half_params", action='store_true', default=False)#False
34
  parser.add_argument("--use_tile_vae", action='store_true', default=True)#False
@@ -78,7 +78,7 @@ def check(input_image):
78
  def reset_feedback():
79
  return 3, ''
80
 
81
- @spaces.GPU(duration=240)
82
  def stage1_process(input_image, gamma_correction):
83
  print('Start stage1_process')
84
  if torch.cuda.device_count() == 0:
@@ -100,7 +100,7 @@ def stage1_process(input_image, gamma_correction):
100
  print('End stage1_process')
101
  return LQ, gr.update(visible = True)
102
 
103
- @spaces.GPU(duration=240)
104
  def llave_process(input_image, temperature, top_p, qs=None):
105
  print('Start llave_process')
106
  if torch.cuda.device_count() == 0:
@@ -116,7 +116,7 @@ def llave_process(input_image, temperature, top_p, qs=None):
116
  print('End llave_process')
117
  return captions[0]
118
 
119
- @spaces.GPU(duration=240)
120
  def stage2_process(
121
  noisy_image,
122
  denoise_image,
@@ -223,7 +223,8 @@ def stage2_process(
223
  ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + \
224
  str(secondes) + " sec."
225
 
226
- return [noisy_image] + results, [noisy_image] + results, gr.update(value = information, visible = True), event_id
 
227
 
228
  def load_and_reset(param_setting):
229
  print('Start load_and_reset')
@@ -284,7 +285,7 @@ title_html = """
284
  LlaVa is not integrated in this demo. The content added by SUPIR is imagination, not real-world information.
285
  The aim of SUPIR is the beauty and the illustration.
286
  Most of the processes only last few minutes.
287
- This demo can handle huge images but the process will be aborted if it lasts more than an hour.
288
 
289
  <p><center><a href="https://arxiv.org/abs/2401.13627">Paper</a> &emsp; <a href="http://supir.xpixel.group/">Project Page</a> &emsp; <a href="https://github.com/Fanghua-Yu/SUPIR/blob/master/assets/DemoGuide.png">How to play</a> &emsp; <a href="https://huggingface.co/blog/MonsterMMORPG/supir-sota-image-upscale-better-than-magnific-ai">Local Install Guide</a></center></p>
290
  """
 
28
  parser.add_argument("--ip", type=str, default='127.0.0.1')
29
  parser.add_argument("--port", type=int, default='6688')
30
  parser.add_argument("--no_llava", action='store_true', default=True)#False
31
+ parser.add_argument("--use_image_slider", action='store_true', default=False)#False
32
  parser.add_argument("--log_history", action='store_true', default=False)
33
  parser.add_argument("--loading_half_params", action='store_true', default=False)#False
34
  parser.add_argument("--use_tile_vae", action='store_true', default=True)#False
 
78
  def reset_feedback():
79
  return 3, ''
80
 
81
+ @spaces.GPU(duration=300)
82
  def stage1_process(input_image, gamma_correction):
83
  print('Start stage1_process')
84
  if torch.cuda.device_count() == 0:
 
100
  print('End stage1_process')
101
  return LQ, gr.update(visible = True)
102
 
103
+ @spaces.GPU(duration=300)
104
  def llave_process(input_image, temperature, top_p, qs=None):
105
  print('Start llave_process')
106
  if torch.cuda.device_count() == 0:
 
116
  print('End llave_process')
117
  return captions[0]
118
 
119
+ @spaces.GPU(duration=300)
120
  def stage2_process(
121
  noisy_image,
122
  denoise_image,
 
223
  ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + \
224
  str(secondes) + " sec."
225
 
226
+ # Only one image can be shown in the slider
227
+ return [noisy_image] + [results[0]], [noisy_image] + results, gr.update(value = information, visible = True), event_id
228
 
229
  def load_and_reset(param_setting):
230
  print('Start load_and_reset')
 
285
  LlaVa is not integrated in this demo. The content added by SUPIR is imagination, not real-world information.
286
  The aim of SUPIR is the beauty and the illustration.
287
  Most of the processes only last few minutes.
288
+ This demo can handle huge images but the process will be aborted if it lasts more than 4min.
289
 
290
  <p><center><a href="https://arxiv.org/abs/2401.13627">Paper</a> &emsp; <a href="http://supir.xpixel.group/">Project Page</a> &emsp; <a href="https://github.com/Fanghua-Yu/SUPIR/blob/master/assets/DemoGuide.png">How to play</a> &emsp; <a href="https://huggingface.co/blog/MonsterMMORPG/supir-sota-image-upscale-better-than-magnific-ai">Local Install Guide</a></center></p>
291
  """