Spaces:
Runtime error
Runtime error
use text
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import gradio as gr
|
|
| 4 |
import numpy as np
|
| 5 |
from TTS.api import TTS
|
| 6 |
from huggingface_hub import snapshot_download
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
MAX_TXT_LEN = 100
|
|
@@ -24,13 +25,16 @@ def generate_audio(text):
|
|
| 24 |
# )
|
| 25 |
# if synthesizer is None:
|
| 26 |
# raise NameError("model not found")
|
| 27 |
-
tts = TTS(model_path="Kinyarwanda_YourTTS/model.pth",
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
wav = tts.tts(text, speaker_wav="kinyarwanda_YourTTS/conditioning_audio.wav")
|
| 33 |
-
return wav
|
|
|
|
|
|
|
|
|
|
| 34 |
# with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 35 |
# synthesizer.save_wav(wav, fp)
|
| 36 |
# return fp.name
|
|
@@ -43,7 +47,8 @@ iface = gr.Interface(
|
|
| 43 |
default="This sentence has been generated by a speech synthesis system.",
|
| 44 |
),
|
| 45 |
],
|
| 46 |
-
outputs=gr.outputs.Audio(type="numpy",label="Output"),
|
|
|
|
| 47 |
title="Kinyarwanda tts Demo",
|
| 48 |
description="Kinyarwanda tts build with ",
|
| 49 |
allow_flagging=False,
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
from TTS.api import TTS
|
| 6 |
from huggingface_hub import snapshot_download
|
| 7 |
+
import subprocess
|
| 8 |
|
| 9 |
|
| 10 |
MAX_TXT_LEN = 100
|
|
|
|
| 25 |
# )
|
| 26 |
# if synthesizer is None:
|
| 27 |
# raise NameError("model not found")
|
| 28 |
+
# tts = TTS(model_path="Kinyarwanda_YourTTS/model.pth",
|
| 29 |
+
# config_path="Kinyarwanda_YourTTS/config.json",
|
| 30 |
+
# tts_speakers_file="Kinyarwanda_YourTTS/speakers.pth",
|
| 31 |
+
# encoder_checkpoint="Kinyarwanda_YourTTS/SE_checkpoint.pth.tar",
|
| 32 |
+
# encoder_config="Kinyarwanda_YourTTS/config_se.json",)
|
| 33 |
+
# wav = tts.tts(text, speaker_wav="kinyarwanda_YourTTS/conditioning_audio.wav")
|
| 34 |
+
# return wav
|
| 35 |
+
text1 = subprocess.check_output("ls", shell=True)+' '+ subprocess.check_output("ls", shell=True)
|
| 36 |
+
text2 = text1.decode("utf-8")
|
| 37 |
+
return text2
|
| 38 |
# with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 39 |
# synthesizer.save_wav(wav, fp)
|
| 40 |
# return fp.name
|
|
|
|
| 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,
|