Spaces:
Running
Running
Tristan Thrush
commited on
Commit
•
a7f2116
1
Parent(s):
4ab0962
bugfix
Browse files
app.py
CHANGED
@@ -158,8 +158,6 @@ st.experimental_set_query_params(**{"dataset": [dataset]})
|
|
158 |
dataset_df = dataframe[dataframe.dataset == dataset]
|
159 |
dataset_df = dataset_df.dropna(axis="columns", how="all")
|
160 |
|
161 |
-
selectable_metrics = list(filter(lambda column: column not in ("model_id", "dataset", "split", "config"), dataset_df.columns))
|
162 |
-
|
163 |
if len(dataset_df) > 0:
|
164 |
|
165 |
selectable_configs = list(set(dataset_df["config"]))
|
@@ -176,6 +174,8 @@ if len(dataset_df) > 0:
|
|
176 |
)
|
177 |
dataset_df = dataset_df[dataset_df.split == split]
|
178 |
|
|
|
|
|
179 |
dataset_df = dataset_df.filter(["model_id"] + selectable_metrics)
|
180 |
dataset_df = dataset_df.dropna(thresh=2) # Want at least two non-na values (one for model_id and one for a metric).
|
181 |
|
@@ -202,21 +202,26 @@ if len(dataset_df) > 0:
|
|
202 |
dataset_df = dataset_df.sort_values(by=cols[1:], ascending=[metric in ascending_metrics for metric in cols[1:]])
|
203 |
dataset_df = dataset_df.replace(np.nan, '-')
|
204 |
|
205 |
-
# Make the leaderboard
|
206 |
-
gb = GridOptionsBuilder.from_dataframe(dataset_df)
|
207 |
-
gb.configure_default_column(sortable=False)
|
208 |
-
gb.configure_column(
|
209 |
-
|
210 |
-
|
211 |
-
)
|
212 |
-
for name in selectable_metrics:
|
213 |
-
|
214 |
|
215 |
-
gb.configure_column(
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
)
|
|
|
|
|
|
|
220 |
|
221 |
-
|
222 |
-
|
|
|
|
|
|
158 |
dataset_df = dataframe[dataframe.dataset == dataset]
|
159 |
dataset_df = dataset_df.dropna(axis="columns", how="all")
|
160 |
|
|
|
|
|
161 |
if len(dataset_df) > 0:
|
162 |
|
163 |
selectable_configs = list(set(dataset_df["config"]))
|
|
|
174 |
)
|
175 |
dataset_df = dataset_df[dataset_df.split == split]
|
176 |
|
177 |
+
selectable_metrics = list(filter(lambda column: column not in ("model_id", "dataset", "split", "config"), dataset_df.columns))
|
178 |
+
|
179 |
dataset_df = dataset_df.filter(["model_id"] + selectable_metrics)
|
180 |
dataset_df = dataset_df.dropna(thresh=2) # Want at least two non-na values (one for model_id and one for a metric).
|
181 |
|
|
|
202 |
dataset_df = dataset_df.sort_values(by=cols[1:], ascending=[metric in ascending_metrics for metric in cols[1:]])
|
203 |
dataset_df = dataset_df.replace(np.nan, '-')
|
204 |
|
205 |
+
# Make the leaderboard
|
206 |
+
gb = GridOptionsBuilder.from_dataframe(dataset_df)
|
207 |
+
gb.configure_default_column(sortable=False)
|
208 |
+
gb.configure_column(
|
209 |
+
"model_id",
|
210 |
+
cellRenderer=JsCode('''function(params) {return '<a target="_blank" href="https://huggingface.co/'+params.value+'">'+params.value+'</a>'}'''),
|
211 |
+
)
|
212 |
+
for name in selectable_metrics:
|
213 |
+
gb.configure_column(name, type=["numericColumn","numberColumnFilter","customNumericFormat"], precision=2, aggFunc='sum')
|
214 |
|
215 |
+
gb.configure_column(
|
216 |
+
sorting_metric,
|
217 |
+
sortable=True,
|
218 |
+
cellStyle=JsCode('''function(params) { return {'backgroundColor': '#FFD21E'}}''')
|
219 |
+
)
|
220 |
+
|
221 |
+
go = gb.build()
|
222 |
+
AgGrid(dataset_df, gridOptions=go, allow_unsafe_jscode=True)
|
223 |
|
224 |
+
else:
|
225 |
+
st.markdown(
|
226 |
+
"No data to display."
|
227 |
+
)
|