Spaces:
Runtime error
Runtime error
Commit
·
0e13645
1
Parent(s):
84cb4e1
Solve memory problem
Browse files
app.py
CHANGED
@@ -9,26 +9,27 @@ model_path = "./model/model.pth"
|
|
9 |
config_path = "./model/config.json"
|
10 |
output_path = "/tmp/"
|
11 |
|
12 |
-
synthesizer = Synthesizer(
|
13 |
-
tts_checkpoint=model_path,
|
14 |
-
tts_config_path=config_path,
|
15 |
-
tts_speakers_file=None,
|
16 |
-
tts_languages_file=None,
|
17 |
-
vocoder_checkpoint=None,
|
18 |
-
vocoder_config=None,
|
19 |
-
encoder_checkpoint="",
|
20 |
-
encoder_config="",
|
21 |
-
use_cuda=False,
|
22 |
-
)
|
23 |
|
24 |
def run_tts(text):
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
|
|
|
|
32 |
|
33 |
|
34 |
iface = gr.Interface(fn=run_tts, inputs="text", outputs="audio")
|
|
|
9 |
config_path = "./model/config.json"
|
10 |
output_path = "/tmp/"
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
def run_tts(text):
|
14 |
|
15 |
+
synthesizer = Synthesizer(
|
16 |
+
tts_checkpoint=model_path,
|
17 |
+
tts_config_path=config_path,
|
18 |
+
tts_speakers_file=None,
|
19 |
+
tts_languages_file=None,
|
20 |
+
vocoder_checkpoint=None,
|
21 |
+
vocoder_config=None,
|
22 |
+
encoder_checkpoint="",
|
23 |
+
encoder_config="",
|
24 |
+
use_cuda=False,
|
25 |
+
)
|
26 |
|
27 |
+
wav = synthesizer.tts(text)
|
28 |
+
output_file = os.path.join(output_path, "inference.wav")
|
29 |
|
30 |
+
synthesizer.save_wav(wav, output_file)
|
31 |
+
|
32 |
+
return output_file
|
33 |
|
34 |
|
35 |
iface = gr.Interface(fn=run_tts, inputs="text", outputs="audio")
|