kevinwang676 commited on
Commit
63e4fee
1 Parent(s): 430cc0f

Update app_multi.py

Browse files
Files changed (1) hide show
  1. app_multi.py +52 -51
app_multi.py CHANGED
@@ -660,18 +660,18 @@ with app:
660
  with gr.Row():
661
  with gr.Column():
662
  input_audio = as_audio_vocals
663
- vc_convert_btn = gr.Button('进行歌声转换吧!', variant='primary')
664
  full_song = gr.Button("加入歌曲伴奏吧!", variant="primary")
665
  new_song = gr.Audio(label="AI歌手+伴奏", type="filepath")
666
 
667
- pitch_adjust = gr.Slider(
668
  label='Pitch',
669
  minimum=-24,
670
  maximum=24,
671
  step=1,
672
  value=0
673
  )
674
- f0_method = gr.Radio(
675
  label='f0 methods',
676
  choices=['pm', 'rmvpe'],
677
  value='pm',
@@ -679,7 +679,7 @@ with app:
679
  )
680
 
681
  with gr.Accordion('更多设置', open=False):
682
- feat_ratio = gr.Slider(
683
  label='Feature ratio',
684
  minimum=0,
685
  maximum=1,
@@ -687,7 +687,7 @@ with app:
687
  value=0.6,
688
  visible=False
689
  )
690
- filter_radius = gr.Slider(
691
  label='Filter radius',
692
  minimum=0,
693
  maximum=7,
@@ -695,7 +695,7 @@ with app:
695
  value=3,
696
  visible=False
697
  )
698
- rms_mix_rate = gr.Slider(
699
  label='Volume envelope mix rate',
700
  minimum=0,
701
  maximum=1,
@@ -703,7 +703,7 @@ with app:
703
  value=1,
704
  visible=False
705
  )
706
- resample_rate = gr.Dropdown(
707
  [
708
  'Disable resampling',
709
  '16000',
@@ -717,7 +717,7 @@ with app:
717
 
718
  with gr.Column():
719
  # Model select
720
- model_index = gr.Dropdown(
721
  [
722
  '%s - %s' % (
723
  m['metadata'].get('source', 'Unknown'),
@@ -737,8 +737,39 @@ with app:
737
  elem_id='model_info'
738
  )
739
 
740
- output_audio = gr.Audio(label='AI歌手(无伴奏)', type="filepath")
741
- output_msg = gr.Textbox(label='Output message')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
742
 
743
  with gr.Tab('🎙️ - 文本转语音'):
744
  with gr.Row():
@@ -760,14 +791,14 @@ with app:
760
  )
761
 
762
  tts_convert_btn = gr.Button('进行AI变声吧', variant='primary')
763
- pitch_adjust = gr.Slider(
764
  label='Pitch',
765
  minimum=-24,
766
  maximum=24,
767
  step=1,
768
  value=0
769
  )
770
- f0_method = gr.Radio(
771
  label='f0 methods',
772
  choices=['pm', 'rmvpe'],
773
  value='pm',
@@ -775,7 +806,7 @@ with app:
775
  )
776
 
777
  with gr.Accordion('更多设置', open=False):
778
- feat_ratio = gr.Slider(
779
  label='Feature ratio',
780
  minimum=0,
781
  maximum=1,
@@ -783,7 +814,7 @@ with app:
783
  value=0.6,
784
  visible=False
785
  )
786
- filter_radius = gr.Slider(
787
  label='Filter radius',
788
  minimum=0,
789
  maximum=7,
@@ -791,7 +822,7 @@ with app:
791
  value=3,
792
  visible=False
793
  )
794
- rms_mix_rate = gr.Slider(
795
  label='Volume envelope mix rate',
796
  minimum=0,
797
  maximum=1,
@@ -799,7 +830,7 @@ with app:
799
  value=1,
800
  visible=False
801
  )
802
- resample_rate = gr.Dropdown(
803
  [
804
  'Disable resampling',
805
  '16000',
@@ -813,7 +844,7 @@ with app:
813
 
814
  with gr.Column():
815
  # Model select
816
- model_index = gr.Dropdown(
817
  [
818
  '%s - %s' % (
819
  m['metadata'].get('source', 'Unknown'),
@@ -833,8 +864,8 @@ with app:
833
  elem_id='model_info'
834
  )
835
 
836
- output_audio = gr.Audio(label='AI歌手(无伴奏)', type="filepath")
837
- output_msg = gr.Textbox(label='Output message')
838
 
839
  with gr.Tab("📺 - 音乐视频"):
840
  with gr.Row():
@@ -848,39 +879,9 @@ with app:
848
  out1 = gr.Video(label='您的专属音乐视频')
849
 
850
  btn.click(fn=infer, inputs=[inp1, inp2, inp3], outputs=[out1])
851
-
852
- vc_convert_btn.click(
853
- vc_func,
854
- [
855
- input_audio, model_index, pitch_adjust, f0_method, feat_ratio,
856
- filter_radius, rms_mix_rate, resample_rate
857
- ],
858
- [output_audio, output_msg],
859
- api_name='audio_conversion'
860
- )
861
-
862
- tts_convert_btn.click(
863
- edge_tts_vc_func,
864
- [
865
- tts_input, model_index, tts_speaker, pitch_adjust, f0_method,
866
- feat_ratio, filter_radius, rms_mix_rate, resample_rate
867
- ],
868
- [output_audio, output_msg],
869
- api_name='tts_conversion'
870
- )
871
-
872
- full_song.click(fn=mix, inputs=[output_audio, as_audio_no_vocals], outputs=[new_song])
873
-
874
- model_index.change(
875
- update_model_info,
876
- inputs=[model_index],
877
- outputs=[model_info],
878
- show_progress=False,
879
- queue=False
880
- )
881
-
882
  gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
883
- gr.Markdown("### <center>🧸 - 如何使用此程序:填写视频网址和视频起止时间后,依次点击“提取声音文件吧”、“去除背景音吧”、“进行歌声转换吧!”、“加入歌曲伴奏吧!”四个按键即可。</center>")
884
  gr.HTML('''
885
  <div class="footer">
886
  <p>🌊🏞️🎶 - 江水东流急,滔滔无尽声。 明·顾璘
 
660
  with gr.Row():
661
  with gr.Column():
662
  input_audio = as_audio_vocals
663
+ vc_convert_btn1 = gr.Button('进行歌声转换吧!', variant='primary')
664
  full_song = gr.Button("加入歌曲伴奏吧!", variant="primary")
665
  new_song = gr.Audio(label="AI歌手+伴奏", type="filepath")
666
 
667
+ pitch_adjust1 = gr.Slider(
668
  label='Pitch',
669
  minimum=-24,
670
  maximum=24,
671
  step=1,
672
  value=0
673
  )
674
+ f0_method1 = gr.Radio(
675
  label='f0 methods',
676
  choices=['pm', 'rmvpe'],
677
  value='pm',
 
679
  )
680
 
681
  with gr.Accordion('更多设置', open=False):
682
+ feat_ratio1 = gr.Slider(
683
  label='Feature ratio',
684
  minimum=0,
685
  maximum=1,
 
687
  value=0.6,
688
  visible=False
689
  )
690
+ filter_radius1 = gr.Slider(
691
  label='Filter radius',
692
  minimum=0,
693
  maximum=7,
 
695
  value=3,
696
  visible=False
697
  )
698
+ rms_mix_rate1 = gr.Slider(
699
  label='Volume envelope mix rate',
700
  minimum=0,
701
  maximum=1,
 
703
  value=1,
704
  visible=False
705
  )
706
+ resample_rate1 = gr.Dropdown(
707
  [
708
  'Disable resampling',
709
  '16000',
 
717
 
718
  with gr.Column():
719
  # Model select
720
+ model_index1 = gr.Dropdown(
721
  [
722
  '%s - %s' % (
723
  m['metadata'].get('source', 'Unknown'),
 
737
  elem_id='model_info'
738
  )
739
 
740
+ output_audio1 = gr.Audio(label='AI歌手(无伴奏)', type="filepath")
741
+ output_msg1 = gr.Textbox(label='Output message')
742
+
743
+ vc_convert_btn1.click(
744
+ vc_func,
745
+ [
746
+ input_audio, model_index1, pitch_adjust1, f0_method1, feat_ratio1,
747
+ filter_radius1, rms_mix_rate1, resample_rate1
748
+ ],
749
+ [output_audio1, output_msg1],
750
+ api_name='audio_conversion'
751
+ )
752
+
753
+ tts_convert_btn.click(
754
+ edge_tts_vc_func,
755
+ [
756
+ tts_input, model_index1, tts_speaker, pitch_adjust2, f0_method2,
757
+ feat_ratio2, filter_radius2, rms_mix_rate2, resample_rate2
758
+ ],
759
+ [output_audio2, output_msg2],
760
+ api_name='tts_conversion'
761
+ )
762
+
763
+ full_song.click(fn=mix, inputs=[output_audio, as_audio_no_vocals], outputs=[new_song])
764
+
765
+ model_index.change(
766
+ update_model_info,
767
+ inputs=[model_index],
768
+ outputs=[model_info],
769
+ show_progress=False,
770
+ queue=False
771
+ )
772
+
773
 
774
  with gr.Tab('🎙️ - 文本转语音'):
775
  with gr.Row():
 
791
  )
792
 
793
  tts_convert_btn = gr.Button('进行AI变声吧', variant='primary')
794
+ pitch_adjust2 = gr.Slider(
795
  label='Pitch',
796
  minimum=-24,
797
  maximum=24,
798
  step=1,
799
  value=0
800
  )
801
+ f0_method2 = gr.Radio(
802
  label='f0 methods',
803
  choices=['pm', 'rmvpe'],
804
  value='pm',
 
806
  )
807
 
808
  with gr.Accordion('更多设置', open=False):
809
+ feat_ratio2 = gr.Slider(
810
  label='Feature ratio',
811
  minimum=0,
812
  maximum=1,
 
814
  value=0.6,
815
  visible=False
816
  )
817
+ filter_radius2 = gr.Slider(
818
  label='Filter radius',
819
  minimum=0,
820
  maximum=7,
 
822
  value=3,
823
  visible=False
824
  )
825
+ rms_mix_rate2 = gr.Slider(
826
  label='Volume envelope mix rate',
827
  minimum=0,
828
  maximum=1,
 
830
  value=1,
831
  visible=False
832
  )
833
+ resample_rate2 = gr.Dropdown(
834
  [
835
  'Disable resampling',
836
  '16000',
 
844
 
845
  with gr.Column():
846
  # Model select
847
+ model_index2 = gr.Dropdown(
848
  [
849
  '%s - %s' % (
850
  m['metadata'].get('source', 'Unknown'),
 
864
  elem_id='model_info'
865
  )
866
 
867
+ output_audio2 = gr.Audio(label='AI歌手(无伴奏)', type="filepath")
868
+ output_msg2 = gr.Textbox(label='Output message')
869
 
870
  with gr.Tab("📺 - 音乐视频"):
871
  with gr.Row():
 
879
  out1 = gr.Video(label='您的专属音乐视频')
880
 
881
  btn.click(fn=infer, inputs=[inp1, inp2, inp3], outputs=[out1])
882
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
  gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
884
+ gr.Markdown("<center>🧸 - 如何使用此程序:填写视频网址和视频起止时间后,依次点击“提取声音文件吧”、“去除背景音吧”、“进行歌声转换吧!”、“加入歌曲伴奏吧!”四个按键即可。</center>")
885
  gr.HTML('''
886
  <div class="footer">
887
  <p>🌊🏞️🎶 - 江水东流急,滔滔无尽声。 明·顾璘