Spaces:
Running
Running
Commit
•
4a85196
1
Parent(s):
947816c
GSK-2456-allow-unselect-on-leaderboard-filter (#18)
Browse files- allow unselect filters (c7bef088007762965ac310075a8028308151a2f6)
- use Any instead of None (8b1e79613995dc26d913cdc4f5efb18dc40ca249)
Co-authored-by: zcy <ZeroCommand@users.noreply.huggingface.co>
- app_leaderboard.py +8 -6
- wordings.py +7 -0
app_leaderboard.py
CHANGED
@@ -29,6 +29,7 @@ def get_model_ids(ds):
|
|
29 |
models = ds["model_id"].tolist()
|
30 |
# return unique elements in the list model_ids
|
31 |
model_ids = list(set(models))
|
|
|
32 |
return model_ids
|
33 |
|
34 |
|
@@ -36,6 +37,7 @@ def get_dataset_ids(ds):
|
|
36 |
logging.info(f"Dataset {ds} column names: {ds['dataset_id']}")
|
37 |
datasets = ds["dataset_id"].tolist()
|
38 |
dataset_ids = list(set(datasets))
|
|
|
39 |
return dataset_ids
|
40 |
|
41 |
|
@@ -89,10 +91,10 @@ def get_demo():
|
|
89 |
interactive=True,
|
90 |
)
|
91 |
model_select = gr.Dropdown(
|
92 |
-
label="Model id", choices=model_ids, interactive=True
|
93 |
)
|
94 |
dataset_select = gr.Dropdown(
|
95 |
-
label="Dataset id", choices=dataset_ids, interactive=True
|
96 |
)
|
97 |
|
98 |
with gr.Row():
|
@@ -120,10 +122,10 @@ def get_demo():
|
|
120 |
# filter the table based on task
|
121 |
df = records[(records["task"] == task)]
|
122 |
# filter the table based on the model_id and dataset_id
|
123 |
-
if model_id:
|
124 |
-
df =
|
125 |
-
if dataset_id:
|
126 |
-
df =
|
127 |
|
128 |
# filter the table based on the columns
|
129 |
df = df[columns]
|
|
|
29 |
models = ds["model_id"].tolist()
|
30 |
# return unique elements in the list model_ids
|
31 |
model_ids = list(set(models))
|
32 |
+
model_ids.insert(0, "Any")
|
33 |
return model_ids
|
34 |
|
35 |
|
|
|
37 |
logging.info(f"Dataset {ds} column names: {ds['dataset_id']}")
|
38 |
datasets = ds["dataset_id"].tolist()
|
39 |
dataset_ids = list(set(datasets))
|
40 |
+
dataset_ids.insert(0, "Any")
|
41 |
return dataset_ids
|
42 |
|
43 |
|
|
|
91 |
interactive=True,
|
92 |
)
|
93 |
model_select = gr.Dropdown(
|
94 |
+
label="Model id", choices=model_ids, value=model_ids[0], interactive=True
|
95 |
)
|
96 |
dataset_select = gr.Dropdown(
|
97 |
+
label="Dataset id", choices=dataset_ids, value=dataset_ids[0], interactive=True
|
98 |
)
|
99 |
|
100 |
with gr.Row():
|
|
|
122 |
# filter the table based on task
|
123 |
df = records[(records["task"] == task)]
|
124 |
# filter the table based on the model_id and dataset_id
|
125 |
+
if model_id and model_id != "Any":
|
126 |
+
df = df[(df['model_id'] == model_id)]
|
127 |
+
if dataset_id and dataset_id != "Any":
|
128 |
+
df = df[(df['dataset_id'] == dataset_id)]
|
129 |
|
130 |
# filter the table based on the columns
|
131 |
df = df[columns]
|
wordings.py
CHANGED
@@ -20,3 +20,10 @@ CONFIRM_MAPPING_DETAILS_FAIL_MD = """
|
|
20 |
CONFIRM_MAPPING_DETAILS_FAIL_RAW = """
|
21 |
Sorry, we cannot align the input/output of your dataset with the model. Pleaser double check your model and dataset.
|
22 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
CONFIRM_MAPPING_DETAILS_FAIL_RAW = """
|
21 |
Sorry, we cannot align the input/output of your dataset with the model. Pleaser double check your model and dataset.
|
22 |
"""
|
23 |
+
|
24 |
+
PREDICTION_SAMPLE_MD = """
|
25 |
+
<h1 style="text-align: center;">
|
26 |
+
Model Prediction Sample
|
27 |
+
</h1>
|
28 |
+
Here is a sample prediction from your model based on your dataset.
|
29 |
+
"""
|