XufengDuan commited on
Commit
c5eb05a
·
1 Parent(s): db0619e

update scripts

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -142,13 +142,13 @@ def update_table(
142
  hidden_df: pd.DataFrame,
143
  columns: list,
144
  #type_query: list,
145
- #precision_query: str,
146
  size_query: list,
147
- #show_deleted: bool,
148
  query: str,
149
  ):
150
  # filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted)
151
- filtered_df = filter_models(hidden_df, size_query)
152
  filtered_df = filter_queries(query, filtered_df)
153
  df = select_columns(filtered_df, columns)
154
  return df
@@ -191,7 +191,7 @@ def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
191
 
192
  def filter_models(
193
  # df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
194
- df: pd.DataFrame, size_query: list # precision_query: list, show_deleted: bool
195
  ) -> pd.DataFrame:
196
  # Show all models
197
  # if show_deleted:
@@ -203,12 +203,12 @@ def filter_models(
203
 
204
  # type_emoji = [t[0] for t in type_query]
205
  #filtered_df = filtered_df.loc[df[utils.AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
206
- #filtered_df = filtered_df.loc[df[utils.AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
207
-
208
- numeric_interval = pd.IntervalIndex(sorted([utils.NUMERIC_INTERVALS[s] for s in size_query]))
209
- params_column = pd.to_numeric(df[utils.AutoEvalColumn.params.name], errors="coerce")
210
- mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
211
- filtered_df = filtered_df.loc[mask]
212
 
213
  return filtered_df
214
 
@@ -249,7 +249,7 @@ try:
249
  # value=False, label="Show gated/private/deleted models", interactive=True
250
  # )
251
  # with gr.Column(min_width=320):
252
- # with gr.Box(elem_id="box-filter"):
253
  # filter_columns_type = gr.CheckboxGroup(
254
  # label="Model types",
255
  # choices=[t.to_str() for t in utils.ModelType],
@@ -299,8 +299,8 @@ try:
299
  hidden_leaderboard_table_for_search,
300
  shown_columns,
301
  #filter_columns_type,
302
- # filter_columns_precision,
303
- # filter_columns_size,
304
  # deleted_models_visibility,
305
  search_bar,
306
  ],
@@ -314,9 +314,9 @@ try:
314
  hidden_leaderboard_table_for_search,
315
  shown_columns,
316
  #filter_columns_type,
317
- #filter_columns_precision,
318
- #filter_columns_size,
319
- #deleted_models_visibility,
320
  search_bar,
321
  ],
322
  leaderboard_table,
 
142
  hidden_df: pd.DataFrame,
143
  columns: list,
144
  #type_query: list,
145
+ precision_query: str,
146
  size_query: list,
147
+ show_deleted: bool,
148
  query: str,
149
  ):
150
  # filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted)
151
+ filtered_df = filter_models(hidden_df, size_query, precision_query, show_deleted)
152
  filtered_df = filter_queries(query, filtered_df)
153
  df = select_columns(filtered_df, columns)
154
  return df
 
191
 
192
  def filter_models(
193
  # df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
194
+ df: pd.DataFrame, size_query: list, precision_query: list, show_deleted: bool
195
  ) -> pd.DataFrame:
196
  # Show all models
197
  # if show_deleted:
 
203
 
204
  # type_emoji = [t[0] for t in type_query]
205
  #filtered_df = filtered_df.loc[df[utils.AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
206
+ # filtered_df = filtered_df.loc[df[utils.AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
207
+ #
208
+ # numeric_interval = pd.IntervalIndex(sorted([utils.NUMERIC_INTERVALS[s] for s in size_query]))
209
+ # params_column = pd.to_numeric(df[utils.AutoEvalColumn.params.name], errors="coerce")
210
+ # mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
211
+ # filtered_df = filtered_df.loc[mask]
212
 
213
  return filtered_df
214
 
 
249
  # value=False, label="Show gated/private/deleted models", interactive=True
250
  # )
251
  # with gr.Column(min_width=320):
252
+ #with gr.Box(elem_id="box-filter"):
253
  # filter_columns_type = gr.CheckboxGroup(
254
  # label="Model types",
255
  # choices=[t.to_str() for t in utils.ModelType],
 
299
  hidden_leaderboard_table_for_search,
300
  shown_columns,
301
  #filter_columns_type,
302
+ #filter_columns_precision,
303
+ #filter_columns_size,
304
  # deleted_models_visibility,
305
  search_bar,
306
  ],
 
314
  hidden_leaderboard_table_for_search,
315
  shown_columns,
316
  #filter_columns_type,
317
+ # filter_columns_precision,
318
+ # filter_columns_size,
319
+ # deleted_models_visibility,
320
  search_bar,
321
  ],
322
  leaderboard_table,