Fabrice-TIERCELIN
commited on
Commit
•
32468cd
1
Parent(s):
264cb2e
File format
Browse files- gradio_demo.py +8 -5
gradio_demo.py
CHANGED
@@ -141,7 +141,8 @@ def stage2_process(
|
|
141 |
linear_s_stage2,
|
142 |
spt_linear_CFG,
|
143 |
spt_linear_s_stage2,
|
144 |
-
model_select
|
|
|
145 |
):
|
146 |
start = time.time()
|
147 |
print('Start stage2_process')
|
@@ -210,9 +211,9 @@ def stage2_process(
|
|
210 |
print('End stage2_process')
|
211 |
end = time.time()
|
212 |
secondes = int(end - start)
|
213 |
-
minutes = secondes
|
214 |
secondes = secondes - (minutes * 60)
|
215 |
-
hours = minutes
|
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) + \
|
@@ -224,7 +225,7 @@ def stage2_process(
|
|
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')
|
@@ -329,6 +330,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
329 |
lines=3)
|
330 |
with gr.Group():
|
331 |
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.")
|
|
|
332 |
|
333 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
334 |
gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
@@ -458,7 +460,8 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
458 |
linear_s_stage2,
|
459 |
spt_linear_CFG,
|
460 |
spt_linear_s_stage2,
|
461 |
-
model_select
|
|
|
462 |
], outputs = [
|
463 |
result_slider,
|
464 |
result_gallery,
|
|
|
141 |
linear_s_stage2,
|
142 |
spt_linear_CFG,
|
143 |
spt_linear_s_stage2,
|
144 |
+
model_select,
|
145 |
+
output_format
|
146 |
):
|
147 |
start = time.time()
|
148 |
print('Start stage2_process')
|
|
|
211 |
print('End stage2_process')
|
212 |
end = time.time()
|
213 |
secondes = int(end - start)
|
214 |
+
minutes = math.floor(secondes / 60)
|
215 |
secondes = secondes - (minutes * 60)
|
216 |
+
hours = math.floor(minutes / 60)
|
217 |
minutes = minutes - (hours * 60)
|
218 |
information = ("Start the process again if you want a different result. " if randomize_seed else "") + \
|
219 |
"The new image resolution is " + str(result_width) + \
|
|
|
225 |
str(secondes) + " sec."
|
226 |
|
227 |
# Only one image can be shown in the slider
|
228 |
+
return [noisy_image] + [results[0]], gr.update(format = output_format, value = [noisy_image] + results), gr.update(value = information, visible = True), event_id
|
229 |
|
230 |
def load_and_reset(param_setting):
|
231 |
print('Start load_and_reset')
|
|
|
330 |
lines=3)
|
331 |
with gr.Group():
|
332 |
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.")
|
333 |
+
output_format = gr.Radio(["png", "webp", "jpeg", "gif", "bmp"], label="Image format for result", info="File extention", value="png", interactive=True)
|
334 |
|
335 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
336 |
gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
|
|
460 |
linear_s_stage2,
|
461 |
spt_linear_CFG,
|
462 |
spt_linear_s_stage2,
|
463 |
+
model_select,
|
464 |
+
output_format
|
465 |
], outputs = [
|
466 |
result_slider,
|
467 |
result_gallery,
|