txya900619 commited on
Commit
9cde8f9
1 Parent(s): 3cfc715

fix: no dialect language can't run bug

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -107,15 +107,18 @@ def use_default_emb_or_custom_radio_input(use_default_emb_or_custom):
107
 
108
  def language_radio_changed(language):
109
  if language in g2p:
110
- return gr.update(visible=False)
111
- dialect_choices = [
112
- (tag.split("_")[1], tag.split("_")[1]) for tag in g2p.keys() if language in tag
113
- ]
 
 
 
114
  return gr.update(
115
  choices=dialect_choices,
116
- value=dialect_choices[0],
117
  interactive=len(dialect_choices) > 1,
118
- visible=True,
119
  )
120
 
121
 
@@ -124,6 +127,7 @@ def update_example(language):
124
 
125
  if language in g2p:
126
  component_props[0]["visible"] = False
 
127
  else:
128
  component_props[0]["visible"] = True
129
  component_props[0]["choices"] = [
 
107
 
108
  def language_radio_changed(language):
109
  if language in g2p:
110
+ dialect_choices = [("None", "")]
111
+ else:
112
+ dialect_choices = [
113
+ (tag.split("_")[1], tag.split("_")[1])
114
+ for tag in g2p.keys()
115
+ if language in tag
116
+ ]
117
  return gr.update(
118
  choices=dialect_choices,
119
+ value=dialect_choices[0][1],
120
  interactive=len(dialect_choices) > 1,
121
+ visible=language not in g2p,
122
  )
123
 
124
 
 
127
 
128
  if language in g2p:
129
  component_props[0]["visible"] = False
130
+ component_props[0]["choices"] = [("None", "")]
131
  else:
132
  component_props[0]["visible"] = True
133
  component_props[0]["choices"] = [