coraKong commited on
Commit
a6f1a9c
1 Parent(s): 0db43d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -6,6 +6,7 @@ tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_
6
  zh_tts = TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST", progress_bar=False, gpu=False)
7
  # de_tts = TTS(model_name = "tts_models/de/thorsten/vits", gpu=False)
8
  de_tts = TTS(model_name = "tts_models/de/thorsten/tacotron2-DCA", gpu=False)
 
9
 
10
  def text_to_speech(text: str, speaker_wav, speaker_wav_file, language: str):
11
  if speaker_wav_file and not speaker_wav:
@@ -17,10 +18,15 @@ def text_to_speech(text: str, speaker_wav, speaker_wav_file, language: str):
17
  # else:
18
  zh_tts.tts_to_file(text, file_path=file_path)
19
  elif language == "de":
20
- if speaker_wav is not None:
21
- de_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
22
- else:
23
- de_tts.tts_to_file(text, file_path=file_path)
 
 
 
 
 
24
  else:
25
  if speaker_wav is not None:
26
  tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path=file_path)
@@ -31,7 +37,7 @@ def text_to_speech(text: str, speaker_wav, speaker_wav_file, language: str):
31
  inputs = [gr.Textbox(label="Input the text", value="", max_lines=3),
32
  gr.Audio(label="Voice to clone", source="microphone", type="filepath"),
33
  gr.Audio(label="Voice to clone", type="filepath"),
34
- gr.Radio(label="Language", choices=["en", "zh-CN", "fr-fr", "de"], value="en")]
35
  outputs = gr.Audio(label="Output")
36
 
37
  demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
 
6
  zh_tts = TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST", progress_bar=False, gpu=False)
7
  # de_tts = TTS(model_name = "tts_models/de/thorsten/vits", gpu=False)
8
  de_tts = TTS(model_name = "tts_models/de/thorsten/tacotron2-DCA", gpu=False)
9
+ es_tts = TTS(model_name = "tts_models/es/mai/tacotron2-DCA", progress_bar=False, 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:
 
18
  # else:
19
  zh_tts.tts_to_file(text, file_path=file_path)
20
  elif language == "de":
21
+ # if speaker_wav is not None:
22
+ # de_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
23
+ # else:
24
+ de_tts.tts_to_file(text, file_path=file_path)
25
+ elif language == "es":
26
+ # if speaker_wav is not None:
27
+ # es_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
28
+ # else:
29
+ es_tts.tts_to_file(text, file_path=file_path)
30
  else:
31
  if speaker_wav is not None:
32
  tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path=file_path)
 
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", "de", "es"], value="en")]
41
  outputs = gr.Audio(label="Output")
42
 
43
  demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)