Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -196,8 +196,12 @@ def create_category_chart(selected_models, selected_categories):
|
|
| 196 |
return fig
|
| 197 |
|
| 198 |
def update_detailed_scorecard(model, selected_categories):
|
| 199 |
-
if model
|
| 200 |
-
return [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
metadata_md = f"## Model Metadata for {model}\n\n"
|
| 203 |
for key, value in models[model]['metadata'].items():
|
|
@@ -294,7 +298,14 @@ def update_dashboard(tab, selected_models, selected_model, selected_categories):
|
|
| 294 |
detailed_scorecard_visibility = gr.update(visible=True)
|
| 295 |
model_chooser_visibility = gr.update(visible=True)
|
| 296 |
category_filter_visibility = gr.update(visible=True)
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
return [leaderboard_visibility, category_chart_visibility, detailed_scorecard_visibility,
|
| 299 |
model_chooser_visibility, model_multi_chooser_visibility, category_filter_visibility,
|
| 300 |
gr.update(), gr.update()] + scorecard_updates
|
|
@@ -307,8 +318,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 307 |
label="Select Tab", value="Leaderboard")
|
| 308 |
|
| 309 |
with gr.Row():
|
| 310 |
-
model_chooser = gr.Dropdown(choices=list(models.keys()),
|
| 311 |
label="Select Model for Details",
|
|
|
|
| 312 |
interactive=True, visible=False)
|
| 313 |
model_multi_chooser = gr.Dropdown(choices=list(models.keys()),
|
| 314 |
label="Select Models for Comparison",
|
|
|
|
| 196 |
return fig
|
| 197 |
|
| 198 |
def update_detailed_scorecard(model, selected_categories):
|
| 199 |
+
if not model: # Check if model is None or an empty string
|
| 200 |
+
return [
|
| 201 |
+
gr.update(value="Please select a model to view details.", visible=True),
|
| 202 |
+
gr.update(visible=False),
|
| 203 |
+
gr.update(visible=False)
|
| 204 |
+
]
|
| 205 |
|
| 206 |
metadata_md = f"## Model Metadata for {model}\n\n"
|
| 207 |
for key, value in models[model]['metadata'].items():
|
|
|
|
| 298 |
detailed_scorecard_visibility = gr.update(visible=True)
|
| 299 |
model_chooser_visibility = gr.update(visible=True)
|
| 300 |
category_filter_visibility = gr.update(visible=True)
|
| 301 |
+
if selected_model:
|
| 302 |
+
scorecard_updates = update_detailed_scorecard(selected_model, selected_categories)
|
| 303 |
+
else:
|
| 304 |
+
scorecard_updates = [
|
| 305 |
+
gr.update(value="Please select a model to view details.", visible=True),
|
| 306 |
+
gr.update(visible=False),
|
| 307 |
+
gr.update(visible=False)
|
| 308 |
+
]
|
| 309 |
return [leaderboard_visibility, category_chart_visibility, detailed_scorecard_visibility,
|
| 310 |
model_chooser_visibility, model_multi_chooser_visibility, category_filter_visibility,
|
| 311 |
gr.update(), gr.update()] + scorecard_updates
|
|
|
|
| 318 |
label="Select Tab", value="Leaderboard")
|
| 319 |
|
| 320 |
with gr.Row():
|
| 321 |
+
model_chooser = gr.Dropdown(choices=[""] + list(models.keys()), # Add an empty option
|
| 322 |
label="Select Model for Details",
|
| 323 |
+
value="", # Set default value to empty string
|
| 324 |
interactive=True, visible=False)
|
| 325 |
model_multi_chooser = gr.Dropdown(choices=list(models.keys()),
|
| 326 |
label="Select Models for Comparison",
|