txya900619 commited on
Commit
10e10ea
·
1 Parent(s): 1bf6df2

fix: 秀姑巒 use ipa bug

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -42,8 +42,10 @@ def text_to_speech(
42
  tag = f"{language}_{dialect}"
43
 
44
  ignore_comma = "gt3" not in model_id
45
-
46
- ipa = text_to_ipa(text, tag, g2p, ignore_comma)
 
 
47
 
48
  models_config[model_id]["model"].tts_model.length_scale = speed
49
  if use_default_emb_or_custom == "預設語者":
@@ -108,6 +110,8 @@ def use_default_emb_or_custom_radio_input(use_default_emb_or_custom):
108
 
109
 
110
  def language_radio_changed(language):
 
 
111
  if language in g2p:
112
  dialect_choices = [("None", "")]
113
  else:
@@ -116,11 +120,16 @@ def language_radio_changed(language):
116
  for tag in g2p.keys()
117
  if language in tag
118
  ]
 
 
 
 
 
119
  return gr.update(
120
  choices=dialect_choices,
121
  value=dialect_choices[0][1],
122
  interactive=len(dialect_choices) > 1,
123
- visible=language not in g2p,
124
  )
125
 
126
 
@@ -138,6 +147,8 @@ def update_example(language):
138
  if language in tag
139
  ]
140
  if language == "阿美_秀姑巒":
 
 
141
  return gr.Dataset(
142
  component_props=component_props,
143
  samples=[
 
42
  tag = f"{language}_{dialect}"
43
 
44
  ignore_comma = "gt3" not in model_id
45
+ if language == "阿美_秀姑巒":
46
+ ipa = text
47
+ else:
48
+ ipa = text_to_ipa(text, tag, g2p, ignore_comma)
49
 
50
  models_config[model_id]["model"].tts_model.length_scale = speed
51
  if use_default_emb_or_custom == "預設語者":
 
110
 
111
 
112
  def language_radio_changed(language):
113
+ visible = language not in g2p
114
+
115
  if language in g2p:
116
  dialect_choices = [("None", "")]
117
  else:
 
120
  for tag in g2p.keys()
121
  if language in tag
122
  ]
123
+
124
+ if language == "阿美_秀姑巒":
125
+ dialect_choices = [("秀姑巒", "秀姑巒")]
126
+ visible = True
127
+
128
  return gr.update(
129
  choices=dialect_choices,
130
  value=dialect_choices[0][1],
131
  interactive=len(dialect_choices) > 1,
132
+ visible=visible,
133
  )
134
 
135
 
 
147
  if language in tag
148
  ]
149
  if language == "阿美_秀姑巒":
150
+ component_props[0]["visible"] = True
151
+ component_props[0]["choices"] = [("秀姑巒", "秀姑巒")]
152
  return gr.Dataset(
153
  component_props=component_props,
154
  samples=[