Commit
•
c8b695a
1
Parent(s):
3782698
Make the Load Details button robust
Browse files
app.py
CHANGED
@@ -166,9 +166,17 @@ def update_subtasks_component(task):
|
|
166 |
return gr.Radio(
|
167 |
SUBTASKS.get(task),
|
168 |
info="Evaluation subtasks to be displayed",
|
|
|
169 |
)
|
170 |
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
def load_details_dataframe(model_id, subtask):
|
173 |
if not model_id or not subtask:
|
174 |
return
|
@@ -250,7 +258,7 @@ with gr.Blocks(fill_height=True) as demo:
|
|
250 |
info="Evaluation subtasks to be displayed (choose one of the Tasks above)",
|
251 |
)
|
252 |
sample_idx = gr.Number(value=0, label="Sample Index", info="Index of the sample to be displayed", minimum=0)
|
253 |
-
load_details_btn = gr.Button("Load Details")
|
254 |
details = gr.HTML()
|
255 |
details_dataframe_1 = gr.Dataframe(visible=False)
|
256 |
details_dataframe_2 = gr.Dataframe(visible=False)
|
@@ -287,6 +295,12 @@ with gr.Blocks(fill_height=True) as demo:
|
|
287 |
inputs=details_task,
|
288 |
outputs=subtask,
|
289 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
load_details_btn.click(
|
291 |
fn=load_details_dataframe,
|
292 |
inputs=[model_id_1, subtask],
|
|
|
166 |
return gr.Radio(
|
167 |
SUBTASKS.get(task),
|
168 |
info="Evaluation subtasks to be displayed",
|
169 |
+
value=None,
|
170 |
)
|
171 |
|
172 |
|
173 |
+
def update_load_details_component(model_id_1, model_id_2, subtask):
|
174 |
+
if (model_id_1 or model_id_2) and subtask:
|
175 |
+
return gr.Button("Load Details", interactive=True)
|
176 |
+
else:
|
177 |
+
return gr.Button("Load Details", interactive=False)
|
178 |
+
|
179 |
+
|
180 |
def load_details_dataframe(model_id, subtask):
|
181 |
if not model_id or not subtask:
|
182 |
return
|
|
|
258 |
info="Evaluation subtasks to be displayed (choose one of the Tasks above)",
|
259 |
)
|
260 |
sample_idx = gr.Number(value=0, label="Sample Index", info="Index of the sample to be displayed", minimum=0)
|
261 |
+
load_details_btn = gr.Button("Load Details", interactive=False)
|
262 |
details = gr.HTML()
|
263 |
details_dataframe_1 = gr.Dataframe(visible=False)
|
264 |
details_dataframe_2 = gr.Dataframe(visible=False)
|
|
|
295 |
inputs=details_task,
|
296 |
outputs=subtask,
|
297 |
)
|
298 |
+
gr.on(
|
299 |
+
triggers=[model_id_1.change, model_id_2.change, subtask.change, details_task.change],
|
300 |
+
fn=update_load_details_component,
|
301 |
+
inputs=[model_id_1, model_id_2, subtask],
|
302 |
+
outputs=load_details_btn,
|
303 |
+
)
|
304 |
load_details_btn.click(
|
305 |
fn=load_details_dataframe,
|
306 |
inputs=[model_id_1, subtask],
|