Spaces:
Running
Running
Use correct labels instead of ISO codes.
Browse files
app.py
CHANGED
@@ -13,9 +13,10 @@ VARIANTS = list(ISO_CODES.values())
|
|
13 |
MODELS = {}
|
14 |
|
15 |
def tts(text, variant):
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
audio = model.synthesis(text)
|
20 |
return (audio['sampling_rate'], audio['x'])
|
21 |
|
@@ -29,7 +30,7 @@ iface = gr.Interface(
|
|
29 |
label="Text",
|
30 |
default="Text to synthesize.",
|
31 |
),
|
32 |
-
gr.inputs.Dropdown(label="Variant", choices=ISO_CODES.
|
33 |
],
|
34 |
outputs=gr.outputs.Audio(label="Output", type="numpy"),
|
35 |
examples=examples,
|
|
|
13 |
MODELS = {}
|
14 |
|
15 |
def tts(text, variant):
|
16 |
+
variant_code = ISO_CODES[variant]
|
17 |
+
if variant_code not in MODELS:
|
18 |
+
MODELS[variant_code] = TTS(variant_code)
|
19 |
+
model = MODELS[variant_code]
|
20 |
audio = model.synthesis(text)
|
21 |
return (audio['sampling_rate'], audio['x'])
|
22 |
|
|
|
30 |
label="Text",
|
31 |
default="Text to synthesize.",
|
32 |
),
|
33 |
+
gr.inputs.Dropdown(label="Variant", choices=list(ISO_CODES.keys()), default="Tachelhit")
|
34 |
],
|
35 |
outputs=gr.outputs.Audio(label="Output", type="numpy"),
|
36 |
examples=examples,
|