kevinwang676 commited on
Commit
af384c2
·
1 Parent(s): 9457eae

Update app_multi.py

Browse files
Files changed (1) hide show
  1. 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
- driven_audio = output_audio
808
- driven_audio_no = gr.Audio(label="Use IDLE mode, no audio is required", source="upload", type="filepath", visible=False)
809
-
810
- with gr.Column():
811
- use_idle_mode = gr.Checkbox(label="Use Idle Animation", visible=False)
812
- length_of_audio = gr.Number(value=5, label="The length(seconds) of the generated video.", visible=False)
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
- with gr.Row():
832
- pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0, visible=False) #
833
- exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="expression scale", value=1, visible=False) #
834
- blink_every = gr.Checkbox(label="use eye blink", value=True, visible=False)
835
-
836
- with gr.Row():
837
- size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?", visible=False) #
838
- preprocess_type = gr.Radio(['crop', 'full'], value='crop', label='是否聚焦角色面部', info="crop:视频会聚焦角色面部;full:视频会显示图片全貌")
839
-
840
- with gr.Row():
841
- is_still_mode = gr.Checkbox(label="静态模式 (开启静态模式,角色的面部动作会减少;默认开启)", value=True)
842
- facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='facerender', info="which face render?", visible=False)
843
-
844
- with gr.Row():
845
- batch_size = gr.Slider(label="Batch size (数值越大,生成速度越快;若显卡性能好,可增大数值)", step=1, maximum=32, value=2)
846
- enhancer = gr.Checkbox(label="GFPGAN as Face enhancer", value=True, visible=False)
847
-
848
-
849
- with gr.Tabs(elem_id="sadtalker_genearted"):
850
- gen_video = gr.Video(label="为您生成的专属���频", format="mp4").style(width=256)
 
851
 
852
  gen_mv.click(fn=combine_music, inputs=[gen_video, as_audio_no_vocals], outputs=[music_video])
853
 
854
- submit.click(
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('''