Spaces:
Running
Running
gavinyuan
commited on
Commit
·
85d0d73
1
Parent(s):
1d86bdc
update: app.py, gpen for video
Browse files
app.py
CHANGED
@@ -440,18 +440,20 @@ def swap_video_gr(img1, target_path, use_gpen=False, frames=9999999):
|
|
440 |
return video_save_path
|
441 |
|
442 |
|
443 |
-
css = """
|
444 |
-
#warning {background-color: #FFCCCB}
|
445 |
-
.feedback textarea {font-size: 24px !important}
|
446 |
-
.run_button {background-color: orange}
|
447 |
-
"""
|
448 |
-
|
449 |
-
|
450 |
if __name__ == "__main__":
|
451 |
use_gpu = torch.cuda.is_available()
|
452 |
|
453 |
with gr.Blocks() as demo:
|
454 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
|
456 |
with gr.Tab("Image"):
|
457 |
with gr.Row():
|
@@ -459,10 +461,10 @@ if __name__ == "__main__":
|
|
459 |
image1_input = gr.Image(label='source')
|
460 |
image2_input = gr.Image(label='target')
|
461 |
image_use_post = gr.Checkbox(label="Post-Process")
|
462 |
-
image_use_gpen = gr.Checkbox(label="Super Resolution")
|
463 |
with gr.Column(scale=2):
|
464 |
image_output = gr.Image()
|
465 |
-
image_button = gr.Button("Run: Face Swapping",
|
466 |
with gr.Tab("Video"):
|
467 |
with gr.Row():
|
468 |
with gr.Column(scale=3):
|
@@ -470,8 +472,9 @@ if __name__ == "__main__":
|
|
470 |
video_input = gr.Video(label='target')
|
471 |
with gr.Column(scale=2):
|
472 |
video_output = gr.Video()
|
473 |
-
video_use_gpen = gr.Checkbox(label="Super Resolution"
|
474 |
-
|
|
|
475 |
image_button.click(
|
476 |
swap_image_gr,
|
477 |
inputs=[image1_input, image2_input, image_use_post, image_use_gpen],
|
|
|
440 |
return video_save_path
|
441 |
|
442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
if __name__ == "__main__":
|
444 |
use_gpu = torch.cuda.is_available()
|
445 |
|
446 |
with gr.Blocks() as demo:
|
447 |
+
gr.Markdown("<div align='center'> <h2> ReliableSwap: Boosting General Face Swapping Via Reliable Supervision </span> </h2> \
|
448 |
+
<a style='font-size:18px;color: #efefef' href='https://arxiv.org/abs/xxxx.xxxx'>Arxiv</a> \
|
449 |
+
<a style='font-size:18px;color: #efefef' href='https://reliable-swap.github.io/'>Homepage</a> \
|
450 |
+
<a style='font-size:18px;color: #efefef' href='https://github.com/ygtxr1997/ReliableSwap'> Github </div>")
|
451 |
+
|
452 |
+
gr.Markdown("""
|
453 |
+
<b>Alternatively, try our GitHub <a href=https://github.com/Winfredy/SadTalker> code </a> on your own GPU. </b>
|
454 |
+
<a style='display:inline-block' href="https://github.com/ygtxr1997/ReliableSwap">
|
455 |
+
<img src="https://img.shields.io/github/stars/ygtxr1997/ReliableSwap?style=social"/></a> \
|
456 |
+
""")
|
457 |
|
458 |
with gr.Tab("Image"):
|
459 |
with gr.Row():
|
|
|
461 |
image1_input = gr.Image(label='source')
|
462 |
image2_input = gr.Image(label='target')
|
463 |
image_use_post = gr.Checkbox(label="Post-Process")
|
464 |
+
image_use_gpen = gr.Checkbox(label="Super Resolution (based on GPEN)")
|
465 |
with gr.Column(scale=2):
|
466 |
image_output = gr.Image()
|
467 |
+
image_button = gr.Button("Run: Face Swapping", variant="primary")
|
468 |
with gr.Tab("Video"):
|
469 |
with gr.Row():
|
470 |
with gr.Column(scale=3):
|
|
|
472 |
video_input = gr.Video(label='target')
|
473 |
with gr.Column(scale=2):
|
474 |
video_output = gr.Video()
|
475 |
+
video_use_gpen = gr.Checkbox(label="Super Resolution (based on GPEN). "
|
476 |
+
"Warning: very time-cost on CPU!")
|
477 |
+
video_button = gr.Button("Run: Face Swapping", variant="primary")
|
478 |
image_button.click(
|
479 |
swap_image_gr,
|
480 |
inputs=[image1_input, image2_input, image_use_post, image_use_gpen],
|