albertvillanova HF staff commited on
Commit
5b4c5f8
1 Parent(s): 0d4c659

Fix tasks interactivity

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -93,6 +93,14 @@ def display_tab(tab, df, task):
93
  return df.to_html()
94
 
95
 
 
 
 
 
 
 
 
 
96
 
97
 
98
  # if __name__ == "__main__":
@@ -117,6 +125,7 @@ with gr.Blocks(fill_height=True) as demo:
117
  label="Tasks",
118
  info="Evaluation tasks to be displayed",
119
  value="All",
 
120
  )
121
 
122
  with gr.Row():
@@ -135,6 +144,10 @@ with gr.Blocks(fill_height=True) as demo:
135
  fn=display_results,
136
  inputs=[dataframe_1, dataframe_2, task],
137
  outputs=[results, configs],
 
 
 
 
138
  )
139
  load_btn_2.click(
140
  fn=load_result_dataframe,
@@ -144,6 +157,10 @@ with gr.Blocks(fill_height=True) as demo:
144
  fn=display_results,
145
  inputs=[dataframe_1, dataframe_2, task],
146
  outputs=[results, configs],
 
 
 
 
147
  )
148
  task.change(
149
  fn=display_results,
 
93
  return df.to_html()
94
 
95
 
96
+ def update_tasks(task):
97
+ return gr.Radio(
98
+ ["All"] + list(TASKS.values()),
99
+ label="Tasks",
100
+ info="Evaluation tasks to be displayed",
101
+ value="All",
102
+ interactive=True,
103
+ )
104
 
105
 
106
  # if __name__ == "__main__":
 
125
  label="Tasks",
126
  info="Evaluation tasks to be displayed",
127
  value="All",
128
+ interactive=False,
129
  )
130
 
131
  with gr.Row():
 
144
  fn=display_results,
145
  inputs=[dataframe_1, dataframe_2, task],
146
  outputs=[results, configs],
147
+ ).then(
148
+ fn=update_tasks,
149
+ inputs=task,
150
+ outputs=task,
151
  )
152
  load_btn_2.click(
153
  fn=load_result_dataframe,
 
157
  fn=display_results,
158
  inputs=[dataframe_1, dataframe_2, task],
159
  outputs=[results, configs],
160
+ ).then(
161
+ fn=update_tasks,
162
+ inputs=task,
163
+ outputs=task,
164
  )
165
  task.change(
166
  fn=display_results,