Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -6,10 +6,8 @@ model_name = "tts_models/zh-CN/baker/tacotron2-DDC-GST"
|
|
6 |
# Init TTS
|
7 |
tts = TTS(model_name, progress_bar=False, gpu=False)
|
8 |
|
9 |
-
def text_to_speech(text: str, speaker_wav, language: str
|
10 |
-
if
|
11 |
-
tts = TTS(model, progress_bar=False, gpu=False)
|
12 |
-
if speaker_wav:
|
13 |
tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path="output.wav")
|
14 |
else:
|
15 |
tts.tts_to_file(text, speaker=tts.speakers[0], language=language, file_path="output.wav")
|
@@ -17,8 +15,7 @@ def text_to_speech(text: str, speaker_wav, language: str, model):
|
|
17 |
|
18 |
inputs = [gr.Textbox(label="Input the text", value="Hello!", max_lines=3),
|
19 |
gr.Audio(lable="Input your voice here", source="microphone", type="filepath"),
|
20 |
-
gr.Radio(label="Language", choices=tts.languages, value="en")
|
21 |
-
gr.Dropdown(label="Model", choices=TTS.list_models, value="tts_models/zh-CN/baker/tacotron2-DDC-GST")]
|
22 |
outputs = gr.Audio(label="Output")
|
23 |
|
24 |
demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
|
|
|
6 |
# Init TTS
|
7 |
tts = TTS(model_name, progress_bar=False, gpu=False)
|
8 |
|
9 |
+
def text_to_speech(text: str, speaker_wav, language: str):
|
10 |
+
if speaker_wav is not None:
|
|
|
|
|
11 |
tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path="output.wav")
|
12 |
else:
|
13 |
tts.tts_to_file(text, speaker=tts.speakers[0], language=language, file_path="output.wav")
|
|
|
15 |
|
16 |
inputs = [gr.Textbox(label="Input the text", value="Hello!", max_lines=3),
|
17 |
gr.Audio(lable="Input your voice here", source="microphone", type="filepath"),
|
18 |
+
gr.Radio(label="Language", choices=tts.languages, value="en")]
|
|
|
19 |
outputs = gr.Audio(label="Output")
|
20 |
|
21 |
demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
|