Commit
·
86e510b
1
Parent(s):
ddc1d20
fix: Do nothing in update_colour_mapping if model_ids is empty
Browse files
app.py
CHANGED
@@ -353,18 +353,15 @@ def main() -> None:
|
|
353 |
"Alexandra Institute</a>.</center>"
|
354 |
)
|
355 |
|
|
|
356 |
language_names_dropdown.change(
|
357 |
fn=partial(update_model_ids_dropdown, results_dfs=results_dfs),
|
358 |
inputs=[language_names_dropdown, model_ids_dropdown],
|
359 |
outputs=model_ids_dropdown,
|
360 |
-
).then(
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
fn=partial(
|
365 |
-
produce_radial_plot,
|
366 |
-
results_dfs=results_dfs,
|
367 |
-
),
|
368 |
inputs=[
|
369 |
model_ids_dropdown,
|
370 |
language_names_dropdown,
|
@@ -375,24 +372,76 @@ def main() -> None:
|
|
375 |
],
|
376 |
outputs=plot,
|
377 |
)
|
378 |
-
language_names_dropdown.change(
|
379 |
-
fn=update_colour_mapping, inputs=model_ids_dropdown
|
380 |
-
).then(**update_plot_kwargs)
|
381 |
model_ids_dropdown.change(
|
382 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
383 |
-
).then(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
use_rank_score_checkbox.change(
|
385 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
386 |
-
).then(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
show_scale_checkbox.change(
|
388 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
389 |
-
).then(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
plot_width_slider.change(
|
391 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
392 |
-
).then(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
plot_height_slider.change(
|
394 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
395 |
-
).then(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
|
397 |
demo.launch()
|
398 |
|
@@ -740,6 +789,9 @@ def update_colour_mapping(model_ids: list[str]) -> None:
|
|
740 |
model_ids:
|
741 |
The model ids to update the colour
|
742 |
"""
|
|
|
|
|
|
|
743 |
global colour_mapping
|
744 |
global seed
|
745 |
seed += 1
|
|
|
353 |
"Alexandra Institute</a>.</center>"
|
354 |
)
|
355 |
|
356 |
+
# Update plot when anything changes
|
357 |
language_names_dropdown.change(
|
358 |
fn=partial(update_model_ids_dropdown, results_dfs=results_dfs),
|
359 |
inputs=[language_names_dropdown, model_ids_dropdown],
|
360 |
outputs=model_ids_dropdown,
|
361 |
+
).then(
|
362 |
+
fn=update_colour_mapping, inputs=model_ids_dropdown
|
363 |
+
).then(
|
364 |
+
fn=partial(produce_radial_plot, results_dfs=results_dfs),
|
|
|
|
|
|
|
|
|
365 |
inputs=[
|
366 |
model_ids_dropdown,
|
367 |
language_names_dropdown,
|
|
|
372 |
],
|
373 |
outputs=plot,
|
374 |
)
|
|
|
|
|
|
|
375 |
model_ids_dropdown.change(
|
376 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
377 |
+
).then(
|
378 |
+
fn=partial(produce_radial_plot, results_dfs=results_dfs),
|
379 |
+
inputs=[
|
380 |
+
model_ids_dropdown,
|
381 |
+
language_names_dropdown,
|
382 |
+
use_rank_score_checkbox,
|
383 |
+
show_scale_checkbox,
|
384 |
+
plot_width_slider,
|
385 |
+
plot_height_slider,
|
386 |
+
],
|
387 |
+
outputs=plot,
|
388 |
+
)
|
389 |
use_rank_score_checkbox.change(
|
390 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
391 |
+
).then(
|
392 |
+
fn=partial(produce_radial_plot, results_dfs=results_dfs),
|
393 |
+
inputs=[
|
394 |
+
model_ids_dropdown,
|
395 |
+
language_names_dropdown,
|
396 |
+
use_rank_score_checkbox,
|
397 |
+
show_scale_checkbox,
|
398 |
+
plot_width_slider,
|
399 |
+
plot_height_slider,
|
400 |
+
],
|
401 |
+
outputs=plot,
|
402 |
+
)
|
403 |
show_scale_checkbox.change(
|
404 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
405 |
+
).then(
|
406 |
+
fn=partial(produce_radial_plot, results_dfs=results_dfs),
|
407 |
+
inputs=[
|
408 |
+
model_ids_dropdown,
|
409 |
+
language_names_dropdown,
|
410 |
+
use_rank_score_checkbox,
|
411 |
+
show_scale_checkbox,
|
412 |
+
plot_width_slider,
|
413 |
+
plot_height_slider,
|
414 |
+
],
|
415 |
+
outputs=plot,
|
416 |
+
)
|
417 |
plot_width_slider.change(
|
418 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
419 |
+
).then(
|
420 |
+
fn=partial(produce_radial_plot, results_dfs=results_dfs),
|
421 |
+
inputs=[
|
422 |
+
model_ids_dropdown,
|
423 |
+
language_names_dropdown,
|
424 |
+
use_rank_score_checkbox,
|
425 |
+
show_scale_checkbox,
|
426 |
+
plot_width_slider,
|
427 |
+
plot_height_slider,
|
428 |
+
],
|
429 |
+
outputs=plot,
|
430 |
+
)
|
431 |
plot_height_slider.change(
|
432 |
fn=update_colour_mapping, inputs=model_ids_dropdown
|
433 |
+
).then(
|
434 |
+
fn=partial(produce_radial_plot, results_dfs=results_dfs),
|
435 |
+
inputs=[
|
436 |
+
model_ids_dropdown,
|
437 |
+
language_names_dropdown,
|
438 |
+
use_rank_score_checkbox,
|
439 |
+
show_scale_checkbox,
|
440 |
+
plot_width_slider,
|
441 |
+
plot_height_slider,
|
442 |
+
],
|
443 |
+
outputs=plot,
|
444 |
+
)
|
445 |
|
446 |
demo.launch()
|
447 |
|
|
|
789 |
model_ids:
|
790 |
The model ids to update the colour
|
791 |
"""
|
792 |
+
if not model_ids:
|
793 |
+
return
|
794 |
+
|
795 |
global colour_mapping
|
796 |
global seed
|
797 |
seed += 1
|