Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -326,37 +326,53 @@ If you have any questions, please feel free to reach me out at <b>iceclearwjy@gm
|
|
326 |
<center><img src='https://visitor-badge.laobi.icu/badge?page_id=IceClear/StableSR' alt='visitors'></center>
|
327 |
"""
|
328 |
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
gr.
|
335 |
-
|
336 |
-
|
337 |
-
value=
|
338 |
-
label="
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
label=
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
)
|
361 |
|
362 |
demo.queue(concurrency_count=1)
|
|
|
326 |
<center><img src='https://visitor-badge.laobi.icu/badge?page_id=IceClear/StableSR' alt='visitors'></center>
|
327 |
"""
|
328 |
|
329 |
+
with gr.Blocks(title=title) as demo:
|
330 |
+
gr.Markdown(description)
|
331 |
+
gr.Markdown(article)
|
332 |
+
|
333 |
+
with gr.Row():
|
334 |
+
with gr.Column():
|
335 |
+
image = gr.Image(type="filepath", label="Input")
|
336 |
+
upscale = gr.Number(value=1, label="Rescaling_Factor (Large images require huge time)")
|
337 |
+
dec_w = gr.Slider(0, 1, value=0.5, step=0.01, label='CFW_Fidelity (0 for better quality, 1 for better identity)')
|
338 |
+
seed = gr.Number(value=42, label="Seeds")
|
339 |
+
model_type = gr.Dropdown(
|
340 |
+
choices=["512", "768v"],
|
341 |
+
value="512",
|
342 |
+
label="Model"
|
343 |
+
)
|
344 |
+
ddpm_steps = gr.Slider(10, 1000, value=200, step=1, label='Sampling timesteps for DDPM')
|
345 |
+
colorfix_type = gr.Dropdown(
|
346 |
+
choices=["none", "adain", "wavelet"],
|
347 |
+
value="adain",
|
348 |
+
label="Color_Correction"
|
349 |
+
)
|
350 |
+
run_btn = gr.Button("Run Inference")
|
351 |
+
|
352 |
+
with gr.Column():
|
353 |
+
output_image = gr.Image(type="numpy", label="Output")
|
354 |
+
output_file = gr.File(label="Download the output")
|
355 |
+
|
356 |
+
# Inference trigger
|
357 |
+
run_btn.click(
|
358 |
+
fn=inference,
|
359 |
+
inputs=[image, upscale, dec_w, seed, model_type, ddpm_steps, colorfix_type],
|
360 |
+
outputs=[output_image, output_file]
|
361 |
+
)
|
362 |
+
|
363 |
+
# Example section
|
364 |
+
gr.Examples(
|
365 |
+
examples=[
|
366 |
+
['./01.png', 4, 0.5, 42, "512", 200, "adain"],
|
367 |
+
['./02.png', 4, 0.5, 42, "512", 200, "adain"],
|
368 |
+
['./03.png', 4, 0.5, 42, "512", 200, "adain"],
|
369 |
+
['./04.png', 4, 0.5, 42, "512", 200, "adain"],
|
370 |
+
['./05.png', 4, 0.5, 42, "512", 200, "adain"]
|
371 |
+
],
|
372 |
+
fn=inference,
|
373 |
+
inputs=[image, upscale, dec_w, seed, model_type, ddpm_steps, colorfix_type],
|
374 |
+
outputs=[output_image, output_file],
|
375 |
+
cache_examples=True
|
376 |
)
|
377 |
|
378 |
demo.queue(concurrency_count=1)
|