ajude commited on
Commit
8fcff38
1 Parent(s): 59ce1f5

Adapted app.py to handle language selection based on the selected tab

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -56,17 +56,22 @@ with demo:
56
  value="Select all languages", size="sm", scale=1
57
  )
58
 
59
- def update_bar():
 
 
 
 
 
60
  langs_bar = gr.CheckboxGroup(
61
- choices=[(LANG_SYMBOLS.get(l,l),l) for l in core.languages_list],
62
- value=core.languages_list,
63
  label="Select languages to average over",
64
  elem_id="column-select",
65
  interactive=True,
66
  )
67
  return langs_bar
68
 
69
- select.click(update_bar, inputs=[], outputs=langs_bar)
70
 
71
  with gr.Row():
72
  shown_tasks = gr.CheckboxGroup(
 
56
  value="Select all languages", size="sm", scale=1
57
  )
58
 
59
+ def update_bar(selected_tab):
60
+ if selected_tab in [0, 1]:
61
+ choices = [(LANG_SYMBOLS.get(l, l), l) for l in core.languages_list]
62
+ value = core.languages_list
63
+ else:
64
+ raise ValueError
65
  langs_bar = gr.CheckboxGroup(
66
+ choices=choices,
67
+ value=value,
68
  label="Select languages to average over",
69
  elem_id="column-select",
70
  interactive=True,
71
  )
72
  return langs_bar
73
 
74
+ select.click(update_bar, inputs=[selected_tab], outputs=langs_bar)
75
 
76
  with gr.Row():
77
  shown_tasks = gr.CheckboxGroup(