txya900619 commited on
Commit
a0c110f
1 Parent(s): edacb2c

feat: update default model and let 1p1l model show dialect and speaker dropdown

Browse files
Files changed (2) hide show
  1. app.py +8 -8
  2. configs/models.yaml +15 -12
app.py CHANGED
@@ -60,7 +60,7 @@ def text_to_speech(
60
  if use_default_emb_or_custom == "default":
61
  wav = model.tts(
62
  parse_ipa(ipa),
63
- speaker_name=speaker,
64
  language_name=dialect,
65
  split_sentences=False,
66
  )
@@ -82,11 +82,9 @@ def text_to_speech(
82
  def when_model_selected(model_id):
83
  model_config = models_config[model_id]
84
 
85
- speaker_drop_down_choices = []
86
- if "speaker_mapping" in model_config:
87
- speaker_drop_down_choices = [
88
- (k, v) for k, v in model_config["speaker_mapping"].items()
89
- ]
90
 
91
  dialect_drop_down_choices = [
92
  (k, v) for k, v in model_config["dialect_mapping"].items()
@@ -100,12 +98,12 @@ def when_model_selected(model_id):
100
  gr.update(
101
  choices=speaker_drop_down_choices,
102
  value=speaker_drop_down_choices[0][1] if len(speaker_drop_down_choices) > 0 else None,
103
- visible=len(speaker_drop_down_choices) > 1,
104
  ),
105
  gr.update(
106
  choices=dialect_drop_down_choices,
107
  value=dialect_drop_down_choices[0][1],
108
- visible=len(dialect_drop_down_choices) > 1,
109
  ),
110
  gr.update(visible=use_default_emb_or_ref_radio_visible, value="default"),
111
  )
@@ -161,6 +159,7 @@ with demo:
161
  ],
162
  value=list(models_config[default_model_id]["speaker_mapping"].values())[0],
163
  label="語者",
 
164
  )
165
  use_default_emb_or_custom_radio.input(
166
  use_default_emb_or_custom_radio_input,
@@ -175,6 +174,7 @@ with demo:
175
  ],
176
  value=list(models_config[default_model_id]["dialect_mapping"].values())[0],
177
  label="腔調",
 
178
  )
179
 
180
  model_drop_down.input(
 
60
  if use_default_emb_or_custom == "default":
61
  wav = model.tts(
62
  parse_ipa(ipa),
63
+ speaker_name=speaker if len(models_config[model_id]["speaker_mapping"]) > 1 else None,
64
  language_name=dialect,
65
  split_sentences=False,
66
  )
 
82
  def when_model_selected(model_id):
83
  model_config = models_config[model_id]
84
 
85
+ speaker_drop_down_choices = [
86
+ (k, v) for k, v in model_config["speaker_mapping"].items()
87
+ ]
 
 
88
 
89
  dialect_drop_down_choices = [
90
  (k, v) for k, v in model_config["dialect_mapping"].items()
 
98
  gr.update(
99
  choices=speaker_drop_down_choices,
100
  value=speaker_drop_down_choices[0][1] if len(speaker_drop_down_choices) > 0 else None,
101
+ interactive=len(speaker_drop_down_choices) > 1,
102
  ),
103
  gr.update(
104
  choices=dialect_drop_down_choices,
105
  value=dialect_drop_down_choices[0][1],
106
+ interactive=len(dialect_drop_down_choices) > 1,
107
  ),
108
  gr.update(visible=use_default_emb_or_ref_radio_visible, value="default"),
109
  )
 
159
  ],
160
  value=list(models_config[default_model_id]["speaker_mapping"].values())[0],
161
  label="語者",
162
+ interactive=len(models_config[default_model_id]["speaker_mapping"]) > 1,
163
  )
164
  use_default_emb_or_custom_radio.input(
165
  use_default_emb_or_custom_radio_input,
 
174
  ],
175
  value=list(models_config[default_model_id]["dialect_mapping"].values())[0],
176
  label="腔調",
177
+ interactive=len(models_config[default_model_id]["dialect_mapping"]) > 1,
178
  )
179
 
180
  model_drop_down.input(
configs/models.yaml CHANGED
@@ -1,13 +1,20 @@
 
 
 
 
 
 
 
1
  sixian-hailu-mix:
2
  model: ${load_model:formospeech/taiwanese-hakka-tts-sixian-hailu-mix}
3
  dialect_mapping:
4
  四縣: sixian
5
  海陸: hailu
6
  speaker_mapping: # display_name: id
7
- 四縣/女: XF
8
- 四縣/男: XM
9
- 海陸/女: HF
10
- 海陸/男: HM
11
 
12
  sixian-hailu-mix-se:
13
  model: ${load_model:formospeech/taiwanese-hakka-tts-sixian-hailu-mix-se}
@@ -15,13 +22,9 @@ sixian-hailu-mix-se:
15
  四縣: sixian
16
  海陸: hailu
17
  speaker_mapping: # display_name: id
18
- 四縣/女: XF
19
- 四縣/男: XM
20
- 海陸/女: HF
21
- 海陸/男: HM
22
 
23
- sixian-1p-240417:
24
- model: ${load_model:formospeech/taiwanese-hakka-tts-sixian-1p-240417}
25
- dialect_mapping:
26
- 四縣: sixian
27
 
 
1
+ sixian-1p-240417:
2
+ model: ${load_model:formospeech/taiwanese-hakka-tts-sixian-1p-240417}
3
+ dialect_mapping:
4
+ 四縣: sixian
5
+ speaker_mapping: # display_name: id
6
+ 四縣/女(64): XF
7
+
8
  sixian-hailu-mix:
9
  model: ${load_model:formospeech/taiwanese-hakka-tts-sixian-hailu-mix}
10
  dialect_mapping:
11
  四縣: sixian
12
  海陸: hailu
13
  speaker_mapping: # display_name: id
14
+ 四縣/女(64): XF
15
+ 四縣/男(53): XM
16
+ 海陸/女(54): HF
17
+ 海陸/男(56): HM
18
 
19
  sixian-hailu-mix-se:
20
  model: ${load_model:formospeech/taiwanese-hakka-tts-sixian-hailu-mix-se}
 
22
  四縣: sixian
23
  海陸: hailu
24
  speaker_mapping: # display_name: id
25
+ 四縣/女(64): XF
26
+ 四縣/男(53): XM
27
+ 海陸/女(54): HF
28
+ 海陸/男(56): HM
29
 
 
 
 
 
30