kevinwang676 commited on
Commit
201847d
·
1 Parent(s): 9f4df50

Update app_multi.py

Browse files
Files changed (1) hide show
  1. app_multi.py +83 -1
app_multi.py CHANGED
@@ -769,9 +769,91 @@ with app:
769
  btn = gr.Button("生成您的专属音乐视频吧", variant="primary")
770
 
771
  with gr.Column():
772
- out1 = gr.Video(label='您的专属音乐视频')
773
 
774
  btn.click(fn=infer, inputs=[inp1, inp2, inp3], outputs=[out1])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
775
 
776
  gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
777
  gr.Markdown("<center>🧸 - 如何使用此程序:填写视频网址和视频起止时间后,依次点击“提取声音文件吧”、“去除背景音吧”、“进行歌声转换吧!”、“加入歌曲伴奏吧!”四个按键即可。</center>")
 
769
  btn = gr.Button("生成您的专属音乐视频吧", variant="primary")
770
 
771
  with gr.Column():
772
+ out1 = gr.Video(label='您的专属音乐视频').style(width=256)
773
 
774
  btn.click(fn=infer, inputs=[inp1, inp2, inp3], outputs=[out1])
775
+
776
+ with gr.Tab("🤵‍♀️ - AI歌手数字人"):
777
+ with gr.Row().style(equal_height=False):
778
+ with gr.Column(variant='panel'):
779
+ with gr.Tabs(elem_id="sadtalker_source_image"):
780
+ with gr.TabItem('图片上传'):
781
+ with gr.Row():
782
+ source_image = gr.Image(label="请上传一张您喜欢角色的图片", source="upload", type="filepath", elem_id="img2img_image").style(width=512)
783
+
784
+
785
+ with gr.Tabs(elem_id="sadtalker_driven_audio"):
786
+ with gr.TabItem('💡您还可以将视频下载到本地'):
787
+
788
+ with gr.Row():
789
+ driven_audio = output_audio
790
+ driven_audio_no = gr.Audio(label="Use IDLE mode, no audio is required", source="upload", type="filepath", visible=False)
791
+
792
+ with gr.Column():
793
+ use_idle_mode = gr.Checkbox(label="Use Idle Animation", visible=False)
794
+ length_of_audio = gr.Number(value=5, label="The length(seconds) of the generated video.", visible=False)
795
+ use_idle_mode.change(toggle_audio_file, inputs=use_idle_mode, outputs=[driven_audio, driven_audio_no]) # todo
796
+
797
+ with gr.Row():
798
+ ref_video = gr.Video(label="Reference Video", source="upload", type="filepath", elem_id="vidref", visible=False).style(width=512)
799
+
800
+ with gr.Column():
801
+ use_ref_video = gr.Checkbox(label="Use Reference Video", visible=False)
802
+ 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)
803
+
804
+ ref_video.change(ref_video_fn, inputs=ref_video, outputs=[use_ref_video]) # todo
805
+
806
+
807
+ with gr.Column(variant='panel'):
808
+ with gr.Tabs(elem_id="sadtalker_checkbox"):
809
+ with gr.TabItem('视频设置'):
810
+ with gr.Column(variant='panel'):
811
+ # width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
812
+ # height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
813
+ with gr.Row():
814
+ pose_style = gr.Slider(minimum=0, maximum=45, step=1, label="Pose style", value=0, visible=False) #
815
+ exp_weight = gr.Slider(minimum=0, maximum=3, step=0.1, label="expression scale", value=1, visible=False) #
816
+ blink_every = gr.Checkbox(label="use eye blink", value=True, visible=False)
817
+
818
+ with gr.Row():
819
+ size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?", visible=False) #
820
+ preprocess_type = gr.Radio(['crop', 'full'], value='crop', label='是否聚焦角色面部', info="crop:视频会聚焦角色面部;full:视频会显示图片全貌")
821
+
822
+ with gr.Row():
823
+ is_still_mode = gr.Checkbox(label="静态模式 (开启静态模式,角色的面部动作会减少;默认开启)", value=True)
824
+ facerender = gr.Radio(['facevid2vid','pirender'], value='facevid2vid', label='facerender', info="which face render?", visible=False)
825
+
826
+ with gr.Row():
827
+ batch_size = gr.Slider(label="Batch size (数值越大,生成速度越快;若显卡性能好,可增大数值)", step=1, maximum=32, value=2)
828
+ enhancer = gr.Checkbox(label="GFPGAN as Face enhancer", value=True, visible=False)
829
+
830
+ submit = gr.Button('开始视频聊天吧', elem_id="sadtalker_generate", variant='primary')
831
+
832
+ with gr.Tabs(elem_id="sadtalker_genearted"):
833
+ gen_video = gr.Video(label="为您生成的专属视频", format="mp4").style(width=256)
834
+
835
+
836
+ submit.click(
837
+ fn=sad_talker.test,
838
+ inputs=[source_image,
839
+ driven_audio,
840
+ preprocess_type,
841
+ is_still_mode,
842
+ enhancer,
843
+ batch_size,
844
+ size_of_image,
845
+ pose_style,
846
+ facerender,
847
+ exp_weight,
848
+ use_ref_video,
849
+ ref_video,
850
+ ref_info,
851
+ use_idle_mode,
852
+ length_of_audio,
853
+ blink_every
854
+ ],
855
+ outputs=[gen_video]
856
+ )
857
 
858
  gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
859
  gr.Markdown("<center>🧸 - 如何使用此程序:填写视频网址和视频起止时间后,依次点击“提取声音文件吧”、“去除背景音吧”、“进行歌声转换吧!”、“加入歌曲伴奏吧!”四个按键即可。</center>")