Spaces:
Runtime error
Runtime error
Commit
·
af384c2
1
Parent(s):
9457eae
Update app_multi.py
Browse files- app_multi.py +32 -66
app_multi.py
CHANGED
@@ -793,86 +793,52 @@ with app:
|
|
793 |
with gr.Row():
|
794 |
source_image = gr.Image(label="请上传一张您喜欢角色的图片", source="upload", type="filepath", elem_id="img2img_image").style(width=512)
|
795 |
|
796 |
-
|
797 |
with gr.Tabs(elem_id="sadtalker_driven_audio"):
|
798 |
-
with gr.TabItem(
|
799 |
-
|
|
|
|
|
800 |
submit = gr.Button('想把我唱给你听', elem_id="sadtalker_generate", variant='primary')
|
801 |
|
802 |
gen_mv = gr.Button('为视频添加伴奏吧', variant='primary')
|
803 |
|
804 |
-
music_video = gr.Video(label="视频+伴奏", format="mp4").style(width=256)
|
805 |
-
|
806 |
with gr.Row():
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
use_idle_mode.change(toggle_audio_file, inputs=use_idle_mode, outputs=[driven_audio, driven_audio_no]) # todo
|
814 |
-
|
815 |
-
with gr.Row():
|
816 |
-
ref_video = gr.Video(label="Reference Video", source="upload", type="filepath", elem_id="vidref", visible=False).style(width=512)
|
817 |
-
|
818 |
-
with gr.Column():
|
819 |
-
use_ref_video = gr.Checkbox(label="Use Reference Video", visible=False)
|
820 |
-
ref_info = gr.Radio(['pose', 'blink','pose+blink', 'all'], value='pose', label='Reference Video',info="How to borrow from reference Video?((fully transfer, aka, video driving mode))", visible=False)
|
821 |
-
|
822 |
-
ref_video.change(ref_video_fn, inputs=ref_video, outputs=[use_ref_video]) # todo
|
823 |
-
|
824 |
-
|
825 |
-
with gr.Column(variant='panel'):
|
826 |
with gr.Tabs(elem_id="sadtalker_checkbox"):
|
827 |
with gr.TabItem('视频设置'):
|
828 |
with gr.Column(variant='panel'):
|
829 |
# width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
|
830 |
# height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
|
|
851 |
|
852 |
gen_mv.click(fn=combine_music, inputs=[gen_video, as_audio_no_vocals], outputs=[music_video])
|
853 |
|
854 |
-
|
855 |
-
fn=sad_talker.test,
|
856 |
-
inputs=[source_image,
|
857 |
-
driven_audio,
|
858 |
-
preprocess_type,
|
859 |
-
is_still_mode,
|
860 |
-
enhancer,
|
861 |
-
batch_size,
|
862 |
-
size_of_image,
|
863 |
-
pose_style,
|
864 |
-
facerender,
|
865 |
-
exp_weight,
|
866 |
-
use_ref_video,
|
867 |
-
ref_video,
|
868 |
-
ref_info,
|
869 |
-
use_idle_mode,
|
870 |
-
length_of_audio,
|
871 |
-
blink_every
|
872 |
-
],
|
873 |
-
outputs=[gen_video]
|
874 |
-
)
|
875 |
-
|
876 |
gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
|
877 |
gr.Markdown("<center>🧸 - 如何使用此程序:填写视频网址和视频起止时间后,依次点击“提取声音文件吧”、“去除背景音吧”、“进行歌声转换吧!”、“加入歌曲伴奏吧!”四个按键即可。</center>")
|
878 |
gr.HTML('''
|
|
|
793 |
with gr.Row():
|
794 |
source_image = gr.Image(label="请上传一张您喜欢角色的图片", source="upload", type="filepath", elem_id="img2img_image").style(width=512)
|
795 |
|
|
|
796 |
with gr.Tabs(elem_id="sadtalker_driven_audio"):
|
797 |
+
with gr.TabItem():
|
798 |
+
with gr.Column(variant='panel'):
|
799 |
+
driven_audio = output_audio
|
800 |
+
|
801 |
submit = gr.Button('想把我唱给你听', elem_id="sadtalker_generate", variant='primary')
|
802 |
|
803 |
gen_mv = gr.Button('为视频添加伴奏吧', variant='primary')
|
804 |
|
|
|
|
|
805 |
with gr.Row():
|
806 |
+
|
807 |
+
gen_video = gr.Video(label="AI歌手数字人视频", format="mp4").style(width=256)
|
808 |
+
|
809 |
+
music_video = gr.Video(label="视频+伴奏", format="mp4").style(width=256)
|
810 |
+
|
811 |
+
with gr.Column(variant='panel'):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
812 |
with gr.Tabs(elem_id="sadtalker_checkbox"):
|
813 |
with gr.TabItem('视频设置'):
|
814 |
with gr.Column(variant='panel'):
|
815 |
# width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
|
816 |
# height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
|
817 |
+
pose_style = gr.Slider(minimum=0, maximum=46, step=1, label="Pose style", value=0, visible=False) #
|
818 |
+
size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?", visible=False) #
|
819 |
+
preprocess_type = gr.Radio(['crop', 'full'], value='crop', label='是否聚焦角色面部', info="crop:视频会聚焦角色面部;full:视频会显示图片全貌")
|
820 |
+
is_still_mode = gr.Checkbox(label="静态模式 (开启静态模式,角色的面部动作会减少;默认开启)", value=True)
|
821 |
+
batch_size = gr.Slider(label="Batch size (数值越大,生成速度越快;若显卡性能好,可增大数值)", step=1, maximum=32, value=4)
|
822 |
+
enhancer = gr.Checkbox(label="GFPGAN as Face enhancer", visible=False)
|
823 |
+
|
824 |
+
|
825 |
+
submit.click(
|
826 |
+
fn=sad_talker.test,
|
827 |
+
inputs=[source_image,
|
828 |
+
driven_audio,
|
829 |
+
preprocess_type,
|
830 |
+
is_still_mode,
|
831 |
+
enhancer,
|
832 |
+
batch_size,
|
833 |
+
size_of_image,
|
834 |
+
pose_style
|
835 |
+
],
|
836 |
+
outputs=[gen_video]
|
837 |
+
)
|
838 |
|
839 |
gen_mv.click(fn=combine_music, inputs=[gen_video, as_audio_no_vocals], outputs=[music_video])
|
840 |
|
841 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
842 |
gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
|
843 |
gr.Markdown("<center>🧸 - 如何使用此程序:填写视频网址和视频起止时间后,依次点击“提取声音文件吧”、“去除背景音吧”、“进行歌声转换吧!”、“加入歌曲伴奏吧!”四个按键即可。</center>")
|
844 |
gr.HTML('''
|