Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
|
|
1 |
from typing import Optional
|
2 |
|
3 |
-
from TTS.utils.manage import ModelManager
|
4 |
-
from TTS.utils.synthesizer import Synthesizer
|
5 |
import gradio as gr
|
6 |
-
import
|
7 |
-
|
8 |
|
|
|
|
|
9 |
|
10 |
MODEL_NAMES = [
|
11 |
-
"en/ek1/tacotron2",
|
12 |
"en/ljspeech/tacotron2-DDC",
|
13 |
# "en/ljspeech/tacotron2-DDC_ph",
|
14 |
# "en/ljspeech/glow-tts",
|
@@ -50,6 +50,8 @@ def tts(text: str, model_name: str):
|
|
50 |
if synthesizer is None:
|
51 |
raise NameError("model not found")
|
52 |
wavs = synthesizer.tts(text)
|
|
|
|
|
53 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
54 |
synthesizer.save_wav(wavs, fp)
|
55 |
return fp.name
|
|
|
1 |
+
import tempfile
|
2 |
from typing import Optional
|
3 |
|
|
|
|
|
4 |
import gradio as gr
|
5 |
+
import numpy as np
|
|
|
6 |
|
7 |
+
from TTS.utils.manage import ModelManager
|
8 |
+
from TTS.utils.synthesizer import Synthesizer
|
9 |
|
10 |
MODEL_NAMES = [
|
11 |
+
# "en/ek1/tacotron2",
|
12 |
"en/ljspeech/tacotron2-DDC",
|
13 |
# "en/ljspeech/tacotron2-DDC_ph",
|
14 |
# "en/ljspeech/glow-tts",
|
|
|
50 |
if synthesizer is None:
|
51 |
raise NameError("model not found")
|
52 |
wavs = synthesizer.tts(text)
|
53 |
+
# output = (synthesizer.output_sample_rate, np.array(wavs))
|
54 |
+
# return output
|
55 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
56 |
synthesizer.save_wav(wavs, fp)
|
57 |
return fp.name
|