Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from TTS.api import TTS
|
|
5 |
tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar = False, gpu=False)
|
6 |
zh_tts = TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST", progress_bar=False, gpu=False)
|
7 |
en_tts = TTS(model_name = "tts_models/en/ljspeech/vits", gpu=False)
|
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):
|
@@ -15,17 +15,12 @@ def text_to_speech(text: str, speaker_wav, language: str):
|
|
15 |
zh_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
16 |
else:
|
17 |
zh_tts.tts_to_file(text, file_path=file_path)
|
18 |
-
|
19 |
if speaker_wav is not None:
|
20 |
de_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
21 |
else:
|
22 |
de_tts.tts_to_file(text, file_path=file_path)
|
23 |
-
|
24 |
-
if speaker_wav is not None:
|
25 |
-
fr_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
26 |
-
else:
|
27 |
-
fr_tts.tts_to_file(text, file_path=file_path)
|
28 |
-
else if language == "en":
|
29 |
if speaker_wav is not None:
|
30 |
en_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
31 |
else:
|
@@ -39,7 +34,7 @@ def text_to_speech(text: str, speaker_wav, language: str):
|
|
39 |
|
40 |
inputs = [gr.Textbox(label="Input the text", value="", max_lines=3),
|
41 |
gr.Audio(lable="Input your voice here", source="microphone", type="filepath"),
|
42 |
-
gr.Radio(label="Language", choices=["en", "zh-CN", "fr", "de"], value="en")]
|
43 |
outputs = gr.Audio(label="Output")
|
44 |
|
45 |
demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
|
|
|
5 |
tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar = False, gpu=False)
|
6 |
zh_tts = TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST", progress_bar=False, gpu=False)
|
7 |
en_tts = TTS(model_name = "tts_models/en/ljspeech/vits", gpu=False)
|
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):
|
|
|
15 |
zh_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
16 |
else:
|
17 |
zh_tts.tts_to_file(text, file_path=file_path)
|
18 |
+
elif language == "de":
|
19 |
if speaker_wav is not None:
|
20 |
de_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
21 |
else:
|
22 |
de_tts.tts_to_file(text, file_path=file_path)
|
23 |
+
elif language == "en":
|
|
|
|
|
|
|
|
|
|
|
24 |
if speaker_wav is not None:
|
25 |
en_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
|
26 |
else:
|
|
|
34 |
|
35 |
inputs = [gr.Textbox(label="Input the text", value="", max_lines=3),
|
36 |
gr.Audio(lable="Input your voice here", source="microphone", type="filepath"),
|
37 |
+
gr.Radio(label="Language", choices=["en", "zh-CN", "fr-fr", "de"], value="en")]
|
38 |
outputs = gr.Audio(label="Output")
|
39 |
|
40 |
demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
|