ayymen commited on
Commit
ec56fd8
1 Parent(s): 828732e

Use correct labels instead of ISO codes.

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -13,9 +13,10 @@ VARIANTS = list(ISO_CODES.values())
13
  MODELS = {}
14
 
15
  def tts(text, variant):
16
- if variant not in MODELS:
17
- MODELS[variant] = TTS(variant)
18
- model = MODELS[variant]
 
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.values(), default=VARIANTS[0])
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,