kevinwang676 commited on
Commit
e6c2863
·
1 Parent(s): ffb1b2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -762,10 +762,43 @@ def main():
762
  with gr.Column():
763
  text_output_4 = gr.TextArea(label="Message", visible=False)
764
  audio_output_4 = gr.Audio(label="为您合成的专属语音", elem_id="tts-audio")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765
  btn_4 = gr.Button("声音克隆", variant="primary")
 
766
  btn_4.click(infer_long_text,
767
  inputs=[textbox_4, preset_dropdown_4, prompt_file_4, language_dropdown_4, accent_dropdown_4],
768
  outputs=[text_output_4, audio_output_4])
 
769
 
770
  gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
771
  gr.Markdown("<center>🧸 - 如何使用此程序:在“提取音色”模块上传一段语音并提取音色之后,就可以在“声音克隆”模块一键克隆您喜欢的声音啦!</center>")
 
762
  with gr.Column():
763
  text_output_4 = gr.TextArea(label="Message", visible=False)
764
  audio_output_4 = gr.Audio(label="为您合成的专属语音", elem_id="tts-audio")
765
+
766
+
767
+ radio = gr.Radio(
768
+ ["mic", "file"], value="file", label="How would you like to upload your audio?", visible=False
769
+ )
770
+ mic_input = gr.Mic(label="Input", type="filepath", visible=False)
771
+ audio_file = audio_output_4
772
+ inputs1 = [
773
+ audio_file,
774
+ gr.Dropdown(
775
+ label="Add background noise",
776
+ choices=list(NOISES.keys()),
777
+ value="None",
778
+ visible=False,
779
+ ),
780
+ gr.Dropdown(
781
+ label="Noise Level (SNR)",
782
+ choices=["-5", "0", "10", "20"],
783
+ value="0",
784
+ visible=False,
785
+ ),
786
+ mic_input,
787
+ ]
788
+
789
+ outputs1 = [
790
+ gr.Audio(type="filepath", label="Noisy audio", visible=False),
791
+ gr.Image(label="Noisy spectrogram", visible=False),
792
+ gr.Audio(type="filepath", label="降噪后的专属语音"),
793
+ gr.Image(label="Enhanced spectrogram", visible=False),
794
+ ]
795
+
796
  btn_4 = gr.Button("声音克隆", variant="primary")
797
+ btn_5 = gr.Button("去除噪音", variant="primary")
798
  btn_4.click(infer_long_text,
799
  inputs=[textbox_4, preset_dropdown_4, prompt_file_4, language_dropdown_4, accent_dropdown_4],
800
  outputs=[text_output_4, audio_output_4])
801
+ btn_5.click(fn=demo_fn, inputs=inputs1, outputs=outputs1)
802
 
803
  gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
804
  gr.Markdown("<center>🧸 - 如何使用此程序:在“提取音色”模块上传一段语音并提取音色之后,就可以在“声音克隆”模块一键克隆您喜欢的声音啦!</center>")