gremlin97 commited on
Commit
c144126
·
1 Parent(s): beff22b

Remove column selector, use dataset and metric filters instead

Browse files
Files changed (1) hide show
  1. app.py +17 -47
app.py CHANGED
@@ -99,13 +99,6 @@ def build_tab(df, name):
99
  elem_id="search-bar"
100
  )
101
 
102
- col_selector = gr.CheckboxGroup(
103
- choices=all_cols,
104
- value=all_cols,
105
- label="Select Columns to Display:",
106
- elem_classes="column-select"
107
- )
108
-
109
  # Set datatype to 'markdown' for First Author column to enable clickable links
110
  datatypes = []
111
  for col in pivoted_df.columns:
@@ -155,7 +148,7 @@ def build_tab(df, name):
155
  elem_classes="filter-group"
156
  )
157
 
158
- def update(search, md, org, dset, metrics, cols):
159
  filtered = pivoted_df.copy()
160
 
161
  if search:
@@ -168,32 +161,25 @@ def build_tab(df, name):
168
  filtered = filtered[filtered["Organization"].isin(org)]
169
 
170
  # Filter by dataset and metric - hide columns that don't match
171
- if cols:
172
- display_cols = []
173
- # Always include base columns
174
- for col in ["Model", "Organization", "First Author"]:
175
- if col in cols and col in filtered.columns:
176
- display_cols.append(col)
177
-
178
- # Add metric columns that match selected datasets and metrics
179
- for col in cols:
180
- if col in metric_combo_cols:
181
- # Check if this column matches selected datasets and metrics
182
- col_dataset = col.split(" (")[0]
183
- col_metric = col.split(" (")[1].rstrip(")")
184
- if col_dataset in dset and col_metric in metrics:
185
- display_cols.append(col)
186
-
187
- filtered = filtered[display_cols]
188
 
189
  return filtered
190
 
191
- search_bar.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter, col_selector], table)
192
- model_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter, col_selector], table)
193
- org_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter, col_selector], table)
194
- dataset_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter, col_selector], table)
195
- metric_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter, col_selector], table)
196
- col_selector.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter, col_selector], table)
197
 
198
 
199
  custom_css = """
@@ -275,22 +261,6 @@ custom_css = """
275
  .filter-group label {
276
  font-size: 14px;
277
  }
278
-
279
- .column-select {
280
- margin-bottom: 1.5em;
281
- }
282
-
283
- .column-select label {
284
- display: flex;
285
- flex-wrap: wrap;
286
- gap: 0.5em;
287
- }
288
-
289
- /* Styling for the column select checkboxes to display in rows */
290
- .column-select label > span {
291
- display: inline-flex;
292
- align-items: center;
293
- }
294
  """
295
 
296
  TITLE = """<h1 align="center" id="space-title">MarsBench Leaderboard</h1>"""
 
99
  elem_id="search-bar"
100
  )
101
 
 
 
 
 
 
 
 
102
  # Set datatype to 'markdown' for First Author column to enable clickable links
103
  datatypes = []
104
  for col in pivoted_df.columns:
 
148
  elem_classes="filter-group"
149
  )
150
 
151
+ def update(search, md, org, dset, metrics):
152
  filtered = pivoted_df.copy()
153
 
154
  if search:
 
161
  filtered = filtered[filtered["Organization"].isin(org)]
162
 
163
  # Filter by dataset and metric - hide columns that don't match
164
+ display_cols = ["Model", "Organization", "First Author"]
165
+
166
+ # Add metric columns that match selected datasets and metrics
167
+ for col in metric_combo_cols:
168
+ # Check if this column matches selected datasets and metrics
169
+ col_dataset = col.split(" (")[0]
170
+ col_metric = col.split(" (")[1].rstrip(")")
171
+ if col_dataset in dset and col_metric in metrics:
172
+ display_cols.append(col)
173
+
174
+ filtered = filtered[display_cols]
 
 
 
 
 
 
175
 
176
  return filtered
177
 
178
+ search_bar.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter], table)
179
+ model_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter], table)
180
+ org_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter], table)
181
+ dataset_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter], table)
182
+ metric_filter.change(update, [search_bar, model_filter, org_filter, dataset_filter, metric_filter], table)
 
183
 
184
 
185
  custom_css = """
 
261
  .filter-group label {
262
  font-size: 14px;
263
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  """
265
 
266
  TITLE = """<h1 align="center" id="space-title">MarsBench Leaderboard</h1>"""