Fabrice-TIERCELIN commited on
Commit
ce3d9c1
·
verified ·
1 Parent(s): 52ac9f1

Resolution

Browse files
Files changed (1) hide show
  1. gradio_demo.py +16 -5
gradio_demo.py CHANGED
@@ -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,
@@ -145,6 +145,7 @@ def stage2_process(
145
  ):
146
  start = time.time()
147
  print('Start stage2_process')
 
148
  if torch.cuda.device_count() == 0:
149
  gr.Warning('Set this space to GPU config to make it work.')
150
  return None, None, None
@@ -213,7 +214,12 @@ def stage2_process(
213
  secondes = secondes - (minutes * 60)
214
  hours = minutes // 60
215
  minutes = minutes - (hours * 60)
216
- information = ("Restart the process to get another result. " if randomize_seed else "") + "The image(s) has(ve) been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec."
 
 
 
 
 
217
 
218
  return [noisy_image] + results, [noisy_image] + results, gr.update(value = information, visible = True), event_id
219
 
@@ -278,6 +284,10 @@ title_html = """
278
 
279
 
280
  claim_md = """
 
 
 
 
281
  ## **Terms of use**
282
 
283
  By using this service, users are required to agree to the following terms: The service is a research preview intended for non-commercial use only. It only provides limited safety measures and may generate offensive content. It must not be used for any illegal, harmful, violent, racist, or sexual purposes. The service may collect user dialogue data for future research. Please submit a feedback to us if you get any inappropriate answer! We will collect those to keep improving our models. For an optimal experience, please use desktop computers for this demo, as mobile devices may compromise its quality.
@@ -309,7 +319,8 @@ with gr.Blocks(title="SUPIR") as interface:
309
  'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, '
310
  'hyper sharpness, perfect without deformations.',
311
  lines=3)
312
- a_prompt_hint = gr.HTML("You can use a <a href='"'https://huggingface.co/spaces/MaziyarPanahi/llava-llama-3-8b'"'>LlaVa space</a> to auto-generate the description of your image.")
 
313
 
314
  with gr.Accordion("Pre-denoising (optional)", open=False):
315
  gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
 
78
  def reset_feedback():
79
  return 3, ''
80
 
81
+ @spaces.GPU(duration=3600)
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=3600)
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=3600)
120
  def stage2_process(
121
  noisy_image,
122
  denoise_image,
 
145
  ):
146
  start = time.time()
147
  print('Start stage2_process')
148
+ print(a_prompt)
149
  if torch.cuda.device_count() == 0:
150
  gr.Warning('Set this space to GPU config to make it work.')
151
  return None, None, None
 
214
  secondes = secondes - (minutes * 60)
215
  hours = minutes // 60
216
  minutes = minutes - (hours * 60)
217
+ information = ("Start the process again if you want a different result. " if randomize_seed else "") +
218
+ "The new image resolution is " + str(result_width) + " pixels large and " + str(result_height) + " pixels high, so a resolution of " + f'{result_width * result_height:,}' + " pixels. "
219
+ "The image(s) has(ve) been generated in " +
220
+ ((str(hours) + " h, ") if hours != 0 else "") +
221
+ ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") +
222
+ str(secondes) + " sec."
223
 
224
  return [noisy_image] + results, [noisy_image] + results, gr.update(value = information, visible = True), event_id
225
 
 
284
 
285
 
286
  claim_md = """
287
+ ## **Piracy**
288
+
289
+ The images are not stored but the logs are saved during a month.
290
+
291
  ## **Terms of use**
292
 
293
  By using this service, users are required to agree to the following terms: The service is a research preview intended for non-commercial use only. It only provides limited safety measures and may generate offensive content. It must not be used for any illegal, harmful, violent, racist, or sexual purposes. The service may collect user dialogue data for future research. Please submit a feedback to us if you get any inappropriate answer! We will collect those to keep improving our models. For an optimal experience, please use desktop computers for this demo, as mobile devices may compromise its quality.
 
319
  'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, '
320
  'hyper sharpness, perfect without deformations.',
321
  lines=3)
322
+ with gr.Group():
323
+ a_prompt_hint = gr.HTML("You can use a <a href='"'https://huggingface.co/spaces/MaziyarPanahi/llava-llama-3-8b'"'>LlaVa space</a> to auto-generate the description of your image.")
324
 
325
  with gr.Accordion("Pre-denoising (optional)", open=False):
326
  gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)