coraKong commited on
Commit
392fff0
·
1 Parent(s): c2c3684

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -8,7 +8,9 @@ zh_tts = TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST", progress_bar
8
  # fr_tts = TTS(model_name = "tts_models/fr/css10/vits", gpu=False)
9
  # de_tts = TTS(model_name = "tts_models/de/thorsten/vits", gpu=False)
10
 
11
- def text_to_speech(text: str, speaker_wav, language: str):
 
 
12
  file_path = "output.wav"
13
  if language == "zh-CN":
14
  # if speaker_wav is not None:
@@ -33,7 +35,8 @@ def text_to_speech(text: str, speaker_wav, language: str):
33
  return file_path
34
 
35
  inputs = [gr.Textbox(label="Input the text", value="", max_lines=3),
36
- gr.Audio(label="Voice to clone", source="microphone", type="filepath"),
 
37
  gr.Radio(label="Language", choices=["en", "zh-CN", "fr-fr"], value="en")]
38
  outputs = gr.Audio(label="Output")
39
 
 
8
  # fr_tts = TTS(model_name = "tts_models/fr/css10/vits", gpu=False)
9
  # de_tts = TTS(model_name = "tts_models/de/thorsten/vits", gpu=False)
10
 
11
+ def text_to_speech(text: str, speaker_wav, speaker_wav_file, language: str):
12
+ if speaker_wav_file and not speaker_wav:
13
+ speaker_wav = speaker_wav_file
14
  file_path = "output.wav"
15
  if language == "zh-CN":
16
  # if speaker_wav is not None:
 
35
  return file_path
36
 
37
  inputs = [gr.Textbox(label="Input the text", value="", max_lines=3),
38
+ gr.Audio(label="Voice to clone", source="microphone", type="filepath"),
39
+ gr.Audio(label="Voice to clone", type="filepath"),
40
  gr.Radio(label="Language", choices=["en", "zh-CN", "fr-fr"], value="en")]
41
  outputs = gr.Audio(label="Output")
42