Commit
•
4bf4abc
1
Parent(s):
0360399
style: Kwargs and type hints
Browse files
app.py
CHANGED
@@ -443,13 +443,13 @@ def update_model_ids_dropdown(
|
|
443 |
if language.name in language_names
|
444 |
}
|
445 |
|
446 |
-
unique_models = {
|
447 |
-
model_id
|
448 |
for df in filtered_results_dfs.values()
|
449 |
for model_id in df.index
|
450 |
}
|
451 |
|
452 |
-
filtered_models = [
|
453 |
model_id
|
454 |
for model_id in unique_models
|
455 |
if all(model_id in df.index for df in filtered_results_dfs.values())
|
@@ -461,14 +461,14 @@ def update_model_ids_dropdown(
|
|
461 |
)
|
462 |
return gr.update(choices=[], value=[])
|
463 |
|
464 |
-
valid_selected_models = [
|
465 |
model_id for model_id in model_ids if model_id in filtered_models
|
466 |
]
|
467 |
if not valid_selected_models:
|
468 |
if len(filtered_models) > 1:
|
469 |
-
valid_selected_models = random.sample(filtered_models, k=2)
|
470 |
elif len(filtered_models) == 1:
|
471 |
-
valid_selected_models = random.sample(filtered_models, k=1)
|
472 |
|
473 |
logger.info(
|
474 |
f"Updated model ids dropdown with {len(filtered_models):,} valid models for "
|
|
|
443 |
if language.name in language_names
|
444 |
}
|
445 |
|
446 |
+
unique_models: set[str] = {
|
447 |
+
str(model_id)
|
448 |
for df in filtered_results_dfs.values()
|
449 |
for model_id in df.index
|
450 |
}
|
451 |
|
452 |
+
filtered_models: list[str] = [
|
453 |
model_id
|
454 |
for model_id in unique_models
|
455 |
if all(model_id in df.index for df in filtered_results_dfs.values())
|
|
|
461 |
)
|
462 |
return gr.update(choices=[], value=[])
|
463 |
|
464 |
+
valid_selected_models: list[str] = [
|
465 |
model_id for model_id in model_ids if model_id in filtered_models
|
466 |
]
|
467 |
if not valid_selected_models:
|
468 |
if len(filtered_models) > 1:
|
469 |
+
valid_selected_models = random.sample(population=filtered_models, k=2)
|
470 |
elif len(filtered_models) == 1:
|
471 |
+
valid_selected_models = random.sample(population=filtered_models, k=1)
|
472 |
|
473 |
logger.info(
|
474 |
f"Updated model ids dropdown with {len(filtered_models):,} valid models for "
|