Spaces:
Running
on
A10G
Running
on
A10G
Update app.py
Browse files
app.py
CHANGED
@@ -26,51 +26,37 @@ def sadtalker_demo(result_dir):
|
|
26 |
with gr.Row().style(equal_height=False):
|
27 |
with gr.Column(variant='panel'):
|
28 |
with gr.Tabs(elem_id="sadtalker_source_image"):
|
29 |
-
source_image = gr.Image(visible=False, type="filepath")
|
30 |
with gr.TabItem('Upload image'):
|
31 |
with gr.Row():
|
32 |
-
|
33 |
-
submit_image = gr.Button('Submit', variant='primary')
|
34 |
-
submit_image.click(fn=get_source_image, inputs=input_image, outputs=source_image)
|
35 |
|
36 |
with gr.Tabs(elem_id="sadtalker_driven_audio"):
|
37 |
-
driven_audio = gr.Audio(visible=False, type="filepath")
|
38 |
with gr.TabItem('Upload audio'):
|
39 |
with gr.Column(variant='panel'):
|
40 |
-
|
41 |
-
submit_audio_1 = gr.Button('Submit', variant='primary')
|
42 |
-
submit_audio_1.click(fn=get_driven_audio, inputs=input_audio1, outputs=driven_audio)
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
input_audio2 = gr.Audio(label="Recording audio", source="microphone", type="filepath")
|
47 |
-
submit_audio_2 = gr.Button('Submit', variant='primary')
|
48 |
-
submit_audio_2.click(fn=get_driven_audio, inputs=input_audio2, outputs=driven_audio)
|
49 |
-
|
50 |
-
with gr.TabItem('TTS'):
|
51 |
with gr.Column(variant='panel'):
|
52 |
-
|
53 |
-
|
54 |
-
input_audio3 = gr.Audio(label="Generated audio", type="filepath")
|
55 |
-
submit_audio_3 = gr.Button('Submit', variant='primary')
|
56 |
-
submit_audio_3.click(fn=get_driven_audio, inputs=input_text, outputs=[input_audio3, driven_audio])
|
57 |
|
58 |
with gr.Column(variant='panel'):
|
59 |
gen_video = gr.Video(label="Generated video", format="mp4").style(height=256,width=256)
|
60 |
gen_text = gr.Textbox(visible=False)
|
61 |
submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
|
62 |
-
scale = gr.Slider(minimum=1, maximum=8, step=1, label="GFPGAN scale", value=1)
|
63 |
-
new_video = gr.Video(label="New video", format="mp4").style(height=512,width=512)
|
64 |
-
change_scale = gr.Button('Restore video', elem_id="restore_video", variant='primary')
|
65 |
|
66 |
submit.click(
|
67 |
fn=sad_talker.test,
|
68 |
inputs=[source_image,
|
69 |
driven_audio,
|
|
|
|
|
70 |
gr.Textbox(value=result_dir, visible=False)],
|
71 |
outputs=[gen_video, gen_text]
|
72 |
)
|
73 |
-
change_scale.click(gfpgan, [scale, gen_text], new_video)
|
74 |
|
75 |
return sadtalker_interface
|
76 |
|
|
|
26 |
with gr.Row().style(equal_height=False):
|
27 |
with gr.Column(variant='panel'):
|
28 |
with gr.Tabs(elem_id="sadtalker_source_image"):
|
|
|
29 |
with gr.TabItem('Upload image'):
|
30 |
with gr.Row():
|
31 |
+
source_image = gr.Image(label="Source image", source="upload", type="filepath").style(height=256,width=256)
|
|
|
|
|
32 |
|
33 |
with gr.Tabs(elem_id="sadtalker_driven_audio"):
|
|
|
34 |
with gr.TabItem('Upload audio'):
|
35 |
with gr.Column(variant='panel'):
|
36 |
+
driven_audio = gr.Audio(label="Input audio", source="upload", type="filepath")
|
37 |
+
# submit_audio_1 = gr.Button('Submit', variant='primary')
|
38 |
+
# submit_audio_1.click(fn=get_driven_audio, inputs=input_audio1, outputs=driven_audio)
|
39 |
+
|
40 |
+
with gr.Tabs(elem_id="sadtalker_checkbox"):
|
41 |
+
with gr.TabItem('Settings'):
|
|
|
|
|
|
|
|
|
|
|
42 |
with gr.Column(variant='panel'):
|
43 |
+
is_still_mode = gr.Checkbox(label="w/ Still Mode")
|
44 |
+
enhancer = gr.Checkbox(label="w/ GFPGAN as Face enhancer")
|
|
|
|
|
|
|
45 |
|
46 |
with gr.Column(variant='panel'):
|
47 |
gen_video = gr.Video(label="Generated video", format="mp4").style(height=256,width=256)
|
48 |
gen_text = gr.Textbox(visible=False)
|
49 |
submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
|
|
|
|
|
|
|
50 |
|
51 |
submit.click(
|
52 |
fn=sad_talker.test,
|
53 |
inputs=[source_image,
|
54 |
driven_audio,
|
55 |
+
is_still_mode,
|
56 |
+
enhancer,
|
57 |
gr.Textbox(value=result_dir, visible=False)],
|
58 |
outputs=[gen_video, gen_text]
|
59 |
)
|
|
|
60 |
|
61 |
return sadtalker_interface
|
62 |
|