Spaces:
Running
on
L4
Running
on
L4
Update app.py
Browse files
app.py
CHANGED
|
@@ -339,22 +339,27 @@ td {
|
|
| 339 |
<center><img src='https://api.infinitescript.com/badgen/count?name=sczhou/CodeFormer<ext=Visitors&color=6dc9aa' alt='visitors'></center>
|
| 340 |
"""
|
| 341 |
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
gr.
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
['01.png', True, True, True, 2, 0.7],
|
| 359 |
['02.jpg', True, True, True, 2, 0.7],
|
| 360 |
['03.jpg', True, True, True, 2, 0.7],
|
|
@@ -362,9 +367,11 @@ demo = gr.Interface(
|
|
| 362 |
['05.jpg', True, True, True, 2, 0.1],
|
| 363 |
['06.png', False, True, True, 1, 0.5]
|
| 364 |
],
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
|
|
|
|
|
|
| 368 |
DEBUG = os.getenv('DEBUG') == '1'
|
| 369 |
-
|
| 370 |
-
demo.launch(debug=DEBUG
|
|
|
|
| 339 |
<center><img src='https://api.infinitescript.com/badgen/count?name=sczhou/CodeFormer<ext=Visitors&color=6dc9aa' alt='visitors'></center>
|
| 340 |
"""
|
| 341 |
|
| 342 |
+
with gr.Blocks() as demo:
|
| 343 |
+
gr.Markdown(title)
|
| 344 |
+
gr.Markdown(description)
|
| 345 |
+
with gr.Box():
|
| 346 |
+
with gr.Column():
|
| 347 |
+
input_img = gr.Image(type="filepath", label="Input")
|
| 348 |
+
face_align = gr.Checkbox(value=True, label="Pre_Face_Align")
|
| 349 |
+
background_enhance = gr.Checkbox(value=True, label="Background_Enhance")
|
| 350 |
+
face_enhance = gr.Checkbox(value=True, label="Face_Upsample")
|
| 351 |
+
upscale_factor = gr.Number(value=2, label="Rescaling_Factor (up to 4)")
|
| 352 |
+
codeformer_fidelity = gr.Slider(0, 1, value=0.5, step=0.01, label='Codeformer_Fidelity (0 for better quality, 1 for better identity)')
|
| 353 |
+
submit = gr.Button('Enhance Image')
|
| 354 |
+
with gr.Column():
|
| 355 |
+
output_img = gr.Image(type="filepath", label="Output").style(height='auto')
|
| 356 |
+
note = gr.Markdown("**Please download the output within 30 seconds.**")
|
| 357 |
+
|
| 358 |
+
inps = [input_img, face_align, background_enhance, face_enhance, upscale_factor, codeformer_fidelity]
|
| 359 |
+
outs = [output_img, note]
|
| 360 |
+
submit.click(fn=inference, inputs=inps, outputs=outs)
|
| 361 |
+
|
| 362 |
+
ex = gr.Examples([
|
| 363 |
['01.png', True, True, True, 2, 0.7],
|
| 364 |
['02.jpg', True, True, True, 2, 0.7],
|
| 365 |
['03.jpg', True, True, True, 2, 0.7],
|
|
|
|
| 367 |
['05.jpg', True, True, True, 2, 0.1],
|
| 368 |
['06.png', False, True, True, 1, 0.5]
|
| 369 |
],
|
| 370 |
+
inputs=inps,
|
| 371 |
+
cache_examples=False)
|
| 372 |
+
|
| 373 |
+
gr.Markdown(article)
|
| 374 |
+
|
| 375 |
DEBUG = os.getenv('DEBUG') == '1'
|
| 376 |
+
demo.queue(api_open=False, concurrency_count=2, max_size=10)
|
| 377 |
+
demo.launch(debug=DEBUG)
|