Spaces:
Runtime error
Runtime error
deploy tts
Browse files
app.py
CHANGED
|
@@ -25,12 +25,19 @@ def generate_audio(text):
|
|
| 25 |
# if synthesizer is None:
|
| 26 |
# raise NameError("model not found")
|
| 27 |
#tts_engine= TextToSpeech()
|
| 28 |
-
text1 = subprocess.check_output("pwd", shell=True)+ subprocess.check_output("ls Kinyarwanda_YourTTS", shell=True)
|
| 29 |
-
text2 = text1.decode("utf-8")
|
| 30 |
-
return text2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 32 |
# synthesizer.save_wav(wav, fp)
|
| 33 |
# return fp.name
|
|
|
|
| 34 |
|
| 35 |
iface = gr.Interface(
|
| 36 |
fn=generate_audio,
|
|
@@ -40,8 +47,8 @@ iface = gr.Interface(
|
|
| 40 |
default="This sentence has been generated by a speech synthesis system.",
|
| 41 |
),
|
| 42 |
],
|
| 43 |
-
|
| 44 |
-
outputs=gr.outputs.Textbox(label="Recognized speech from speechbrain model"),
|
| 45 |
title="Kinyarwanda tts Demo",
|
| 46 |
description="Kinyarwanda tts build with ",
|
| 47 |
allow_flagging=False,
|
|
|
|
| 25 |
# if synthesizer is None:
|
| 26 |
# raise NameError("model not found")
|
| 27 |
#tts_engine= TextToSpeech()
|
| 28 |
+
# text1 = subprocess.check_output("pwd", shell=True)+ subprocess.check_output("ls Kinyarwanda_YourTTS", shell=True)
|
| 29 |
+
# text2 = text1.decode("utf-8")
|
| 30 |
+
# return text2
|
| 31 |
+
tts = TTS(model_path="Kinyarwanda_YourTTS/model.pth",
|
| 32 |
+
config_path="Kinyarwanda_YourTTS/config.json",
|
| 33 |
+
tts_speakers_file="Kinyarwanda_YourTTS/speakers.pth",
|
| 34 |
+
encoder_checkpoint="Kinyarwanda_YourTTS/SE_checkpoint.pth.tar",
|
| 35 |
+
encoder_config="Kinyarwanda_YourTTS/config_se.json",)
|
| 36 |
+
wav = tts.tts(text, speaker_wav="Kinyarwanda_YourTTS/conditioning_audio.wav")
|
| 37 |
# with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 38 |
# synthesizer.save_wav(wav, fp)
|
| 39 |
# return fp.name
|
| 40 |
+
return wav
|
| 41 |
|
| 42 |
iface = gr.Interface(
|
| 43 |
fn=generate_audio,
|
|
|
|
| 47 |
default="This sentence has been generated by a speech synthesis system.",
|
| 48 |
),
|
| 49 |
],
|
| 50 |
+
outputs=gr.outputs.Audio(type="numpy",label="Output"),
|
| 51 |
+
#outputs=gr.outputs.Textbox(label="Recognized speech from speechbrain model"),
|
| 52 |
title="Kinyarwanda tts Demo",
|
| 53 |
description="Kinyarwanda tts build with ",
|
| 54 |
allow_flagging=False,
|