Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,20 +14,21 @@ from inference import load_tacotron_model, load_wavegru_net, mel_to_wav, text_to
|
|
14 |
from wavegru_cpp import extract_weight_mask, load_wavegru_cpp
|
15 |
|
16 |
|
17 |
-
|
18 |
-
alphabet,
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
-
wave_cpp_weight_mask = extract_weight_mask(wavegru_net)
|
27 |
-
wavecpp = load_wavegru_cpp(
|
28 |
-
wave_cpp_weight_mask, wavegru_config["upsample_factors"][-1]
|
29 |
-
)
|
30 |
|
|
|
31 |
mel = text_to_mel(tacotron_net, text, alphabet, tacotron_config)
|
32 |
y = mel_to_wav(wavegru_net, wavecpp, mel, wavegru_config)
|
33 |
return 24_000, y
|
|
|
14 |
from wavegru_cpp import extract_weight_mask, load_wavegru_cpp
|
15 |
|
16 |
|
17 |
+
alphabet, tacotron_net, tacotron_config = load_tacotron_model(
|
18 |
+
"./alphabet.txt", "./tacotron.toml", "./tacotrons_ljs_24k_v1_0300000.ckpt"
|
19 |
+
)
|
20 |
+
|
21 |
+
wavegru_config, wavegru_net = load_wavegru_net(
|
22 |
+
"./wavegru.yaml", "./wavegru_vocoder_1024_v4_1320000.ckpt"
|
23 |
+
)
|
24 |
|
25 |
+
wave_cpp_weight_mask = extract_weight_mask(wavegru_net)
|
26 |
+
wavecpp = load_wavegru_cpp(
|
27 |
+
wave_cpp_weight_mask, wavegru_config["upsample_factors"][-1]
|
28 |
+
)
|
29 |
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
def speak(text):
|
32 |
mel = text_to_mel(tacotron_net, text, alphabet, tacotron_config)
|
33 |
y = mel_to_wav(wavegru_net, wavecpp, mel, wavegru_config)
|
34 |
return 24_000, y
|