ZeroCommand commited on
Commit
8b1e796
1 Parent(s): c7bef08

use Any instead of None

Browse files
Files changed (1) hide show
  1. app_leaderboard.py +6 -6
app_leaderboard.py CHANGED
@@ -29,7 +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
- model_ids.insert(0, None)
33
  return model_ids
34
 
35
 
@@ -37,7 +37,7 @@ def get_dataset_ids(ds):
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, None)
41
  return dataset_ids
42
 
43
 
@@ -91,10 +91,10 @@ def get_demo():
91
  interactive=True,
92
  )
93
  model_select = gr.Dropdown(
94
- label="Model id", choices=model_ids, interactive=True
95
  )
96
  dataset_select = gr.Dropdown(
97
- label="Dataset id", choices=dataset_ids, interactive=True
98
  )
99
 
100
  with gr.Row():
@@ -122,9 +122,9 @@ def get_demo():
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:
126
  df = df[(df['model_id'] == model_id)]
127
- if dataset_id:
128
  df = df[(df['dataset_id'] == dataset_id)]
129
 
130
  # filter the table based on the 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