Spaces:
Runtime error
Runtime error
deploy tts
Browse files
app.py
CHANGED
@@ -3,10 +3,12 @@ from typing import Optional
|
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
5 |
from TTS.api import TTS
|
|
|
|
|
6 |
|
7 |
MAX_TXT_LEN = 100
|
8 |
-
|
9 |
-
|
10 |
def generate_audio(text):
|
11 |
if len(text) > MAX_TXT_LEN:
|
12 |
text = text[:MAX_TXT_LEN]
|
@@ -22,8 +24,12 @@ def generate_audio(text):
|
|
22 |
# )
|
23 |
# if synthesizer is None:
|
24 |
# raise NameError("model not found")
|
25 |
-
tts = TTS(
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
return wav
|
28 |
# with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
29 |
# synthesizer.save_wav(wav, fp)
|
|
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
5 |
from TTS.api import TTS
|
6 |
+
from huggingface_hub import hf_hub_download
|
7 |
+
|
8 |
|
9 |
MAX_TXT_LEN = 100
|
10 |
+
|
11 |
+
hf_hub_download(repo_id="DigitalUmuganda/Kinyarwanda_YourTTS")
|
12 |
def generate_audio(text):
|
13 |
if len(text) > MAX_TXT_LEN:
|
14 |
text = text[:MAX_TXT_LEN]
|
|
|
24 |
# )
|
25 |
# if synthesizer is None:
|
26 |
# raise NameError("model not found")
|
27 |
+
tts = TTS(model_path="Kinyarwanda_YourTTS/model.pth",
|
28 |
+
config_path="Kinyarwanda_YourTTS/config.json",
|
29 |
+
tts_speakers_file="Kinyarwanda_YourTTS/speakers.pth"
|
30 |
+
encoder_checkpoint="Kinyarwanda_YourTTS/SE_checkpoint.pth.tar",
|
31 |
+
encoder_config="Kinyarwanda_YourTTS/config_se.json",)
|
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)
|