BenchmarkBot commited on
Commit
02f02af
β€’
1 Parent(s): a3310bf

fix slider filter

Browse files
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -72,13 +72,7 @@ def search_tables(single_df, multi_df, query):
72
  return filtered_single, filtered_multi
73
 
74
 
75
- def threshold_tables(single_df, multi_df, threshold):
76
- filtered_single = single_df[single_df["Average H4 Score ⬆️"] >= threshold]
77
- filtered_multi = multi_df[multi_df["Average H4 Score ⬆️"] >= threshold]
78
- return filtered_single, filtered_multi
79
-
80
-
81
- def filter_tables(single_df, multi_df, backends, datatypes):
82
  filtered_single = single_df[single_df["Backend 🏭"].isin(backends)]
83
  filtered_single = filtered_single[filtered_single["Datatype πŸ“₯"].isin(
84
  datatypes)]
@@ -87,6 +81,9 @@ def filter_tables(single_df, multi_df, backends, datatypes):
87
  filtered_multi = filtered_multi[filtered_multi["Datatype πŸ“₯"].isin(
88
  datatypes)]
89
 
 
 
 
90
  return filtered_single, filtered_multi
91
 
92
 
@@ -104,15 +101,6 @@ with demo:
104
  placeholder="Write and press ENTER...",
105
  elem_id="search-bar",
106
  )
107
- threshold_slider = gr.Slider(
108
- label="Threshold πŸ“ˆ",
109
- info="Filter by average H4 score",
110
- min_value=0.0,
111
- max_value=100.0,
112
- step_size=1.0,
113
- value=0.0,
114
- elem_id="threshold-slider",
115
- )
116
 
117
  backend_checkboxes = gr.CheckboxGroup(
118
  choices=["pytorch", "onnxruntime"],
@@ -128,9 +116,22 @@ with demo:
128
  info="Select the load datatypes",
129
  elem_id="datatype-checkboxes",
130
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  with gr.Row():
132
  submit_button = gr.Button(
133
- label="Submit πŸš€",
134
  info="Submit the filters",
135
  elem_id="submit-button",
136
  )
@@ -194,19 +195,19 @@ with demo:
194
  backend_checkboxes.select(
195
  filter_tables,
196
  [single_A100_for_search, multi_A100_for_search,
197
- backend_checkboxes, datatype_checkboxes],
198
  [single_A100_leaderboard, multi_A100_leaderboard],
199
  )
200
  datatype_checkboxes.select(
201
  filter_tables,
202
  [single_A100_for_search, multi_A100_for_search,
203
- backend_checkboxes, datatype_checkboxes],
204
  [single_A100_leaderboard, multi_A100_leaderboard],
205
  )
206
  threshold_slider.change(
207
  filter_tables,
208
  [single_A100_for_search, multi_A100_for_search,
209
- backend_checkboxes, datatype_checkboxes],
210
  [single_A100_leaderboard, multi_A100_leaderboard],
211
  )
212
 
 
72
  return filtered_single, filtered_multi
73
 
74
 
75
+ def filter_tables(single_df, multi_df, backends, datatypes, threshold):
 
 
 
 
 
 
76
  filtered_single = single_df[single_df["Backend 🏭"].isin(backends)]
77
  filtered_single = filtered_single[filtered_single["Datatype πŸ“₯"].isin(
78
  datatypes)]
 
81
  filtered_multi = filtered_multi[filtered_multi["Datatype πŸ“₯"].isin(
82
  datatypes)]
83
 
84
+ filtered_single = single_df[single_df["Average H4 Score ⬆️"] >= threshold]
85
+ filtered_multi = multi_df[multi_df["Average H4 Score ⬆️"] >= threshold]
86
+
87
  return filtered_single, filtered_multi
88
 
89
 
 
101
  placeholder="Write and press ENTER...",
102
  elem_id="search-bar",
103
  )
 
 
 
 
 
 
 
 
 
104
 
105
  backend_checkboxes = gr.CheckboxGroup(
106
  choices=["pytorch", "onnxruntime"],
 
116
  info="Select the load datatypes",
117
  elem_id="datatype-checkboxes",
118
  )
119
+
120
+ with gr.Row():
121
+ with gr.Box(elem_id="threshold-slider-box"):
122
+ threshold_slider = gr.Slider(
123
+ label="Threshold πŸ“ˆ",
124
+ info="Filter by average H4 score",
125
+ min_value=0.0,
126
+ max_value=100.0,
127
+ step_size=1.0,
128
+ value=0.0,
129
+ elem_id="threshold-slider",
130
+ )
131
+
132
  with gr.Row():
133
  submit_button = gr.Button(
134
+ value="Submit πŸš€",
135
  info="Submit the filters",
136
  elem_id="submit-button",
137
  )
 
195
  backend_checkboxes.select(
196
  filter_tables,
197
  [single_A100_for_search, multi_A100_for_search,
198
+ backend_checkboxes, datatype_checkboxes, threshold_slider],
199
  [single_A100_leaderboard, multi_A100_leaderboard],
200
  )
201
  datatype_checkboxes.select(
202
  filter_tables,
203
  [single_A100_for_search, multi_A100_for_search,
204
+ backend_checkboxes, datatype_checkboxes, threshold_slider],
205
  [single_A100_leaderboard, multi_A100_leaderboard],
206
  )
207
  threshold_slider.change(
208
  filter_tables,
209
  [single_A100_for_search, multi_A100_for_search,
210
+ backend_checkboxes, datatype_checkboxes, threshold_slider],
211
  [single_A100_leaderboard, multi_A100_leaderboard],
212
  )
213