Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -153,8 +153,9 @@ def update_table(
|
|
153 |
size_query: list,
|
154 |
show_deleted: bool,
|
155 |
query: str,
|
|
|
156 |
):
|
157 |
-
filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted)
|
158 |
filtered_df = filter_queries(query, filtered_df)
|
159 |
df = select_columns(filtered_df, columns)
|
160 |
return df
|
@@ -196,7 +197,7 @@ def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
|
|
196 |
|
197 |
|
198 |
def filter_models(
|
199 |
-
df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
|
200 |
) -> pd.DataFrame:
|
201 |
# Show all models
|
202 |
if show_deleted:
|
@@ -204,6 +205,10 @@ def filter_models(
|
|
204 |
else: # Show only still on the hub models
|
205 |
filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
|
206 |
|
|
|
|
|
|
|
|
|
207 |
type_emoji = [t[0] for t in type_query]
|
208 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
209 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
|
@@ -251,6 +256,12 @@ with demo:
|
|
251 |
deleted_models_visibility = gr.Checkbox(
|
252 |
value=False, label="Show gated/private/deleted models", interactive=True
|
253 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
with gr.Column(min_width=320):
|
255 |
#with gr.Box(elem_id="box-filter"):
|
256 |
filter_columns_type = gr.CheckboxGroup(
|
@@ -306,10 +317,11 @@ with demo:
|
|
306 |
filter_columns_size,
|
307 |
deleted_models_visibility,
|
308 |
search_bar,
|
|
|
309 |
],
|
310 |
leaderboard_table,
|
311 |
)
|
312 |
-
for selector in [shown_columns, filter_columns_type, filter_columns_precision, filter_columns_size, deleted_models_visibility]:
|
313 |
selector.change(
|
314 |
update_table,
|
315 |
[
|
@@ -320,6 +332,7 @@ with demo:
|
|
320 |
filter_columns_size,
|
321 |
deleted_models_visibility,
|
322 |
search_bar,
|
|
|
323 |
],
|
324 |
leaderboard_table,
|
325 |
queue=True,
|
|
|
153 |
size_query: list,
|
154 |
show_deleted: bool,
|
155 |
query: str,
|
156 |
+
recent: bool
|
157 |
):
|
158 |
+
filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted, recent)
|
159 |
filtered_df = filter_queries(query, filtered_df)
|
160 |
df = select_columns(filtered_df, columns)
|
161 |
return df
|
|
|
197 |
|
198 |
|
199 |
def filter_models(
|
200 |
+
df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool, recent: bool
|
201 |
) -> pd.DataFrame:
|
202 |
# Show all models
|
203 |
if show_deleted:
|
|
|
205 |
else: # Show only still on the hub models
|
206 |
filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
|
207 |
|
208 |
+
# blz
|
209 |
+
if recent:
|
210 |
+
filtered_df = df[df[AutoEvalColumn.recent.name] == True]
|
211 |
+
|
212 |
type_emoji = [t[0] for t in type_query]
|
213 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
214 |
filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
|
|
|
256 |
deleted_models_visibility = gr.Checkbox(
|
257 |
value=False, label="Show gated/private/deleted models", interactive=True
|
258 |
)
|
259 |
+
|
260 |
+
with gr.Row():
|
261 |
+
filter_recent = gr.Checkbox(
|
262 |
+
value=False, label="Recent", interactive=True
|
263 |
+
)
|
264 |
+
|
265 |
with gr.Column(min_width=320):
|
266 |
#with gr.Box(elem_id="box-filter"):
|
267 |
filter_columns_type = gr.CheckboxGroup(
|
|
|
317 |
filter_columns_size,
|
318 |
deleted_models_visibility,
|
319 |
search_bar,
|
320 |
+
filter_recent,
|
321 |
],
|
322 |
leaderboard_table,
|
323 |
)
|
324 |
+
for selector in [shown_columns, filter_columns_type, filter_columns_precision, filter_columns_size, deleted_models_visibility, filter_recent]:
|
325 |
selector.change(
|
326 |
update_table,
|
327 |
[
|
|
|
332 |
filter_columns_size,
|
333 |
deleted_models_visibility,
|
334 |
search_bar,
|
335 |
+
filter_recent,
|
336 |
],
|
337 |
leaderboard_table,
|
338 |
queue=True,
|