Clémentine commited on
Commit
512b095
1 Parent(s): eed1ccd

small fix when querying models

Browse files
Files changed (1) hide show
  1. app.py +5 -13
app.py CHANGED
@@ -216,22 +216,14 @@ def change_tab(query_param: str):
216
  # Searching and filtering
217
  def update_table(hidden_df: pd.DataFrame, current_columns_df: pd.DataFrame, columns: list, type_query: list, size_query: list, show_deleted: bool, query: str):
218
  filtered_df = filter_models(hidden_df, type_query, size_query, show_deleted)
219
- df = search_table(filtered_df, current_columns_df, query)
220
- df = select_columns(df, columns)
 
221
 
222
  return df
223
 
224
- def search_table(df: pd.DataFrame, current_columns_df: pd.DataFrame, query: str) -> pd.DataFrame:
225
- current_columns = current_columns_df.columns
226
- if AutoEvalColumn.model_type.name in current_columns:
227
- filtered_df = df[
228
- (df[AutoEvalColumn.dummy.name].str.contains(query, case=False))
229
- | (df[AutoEvalColumn.model_type.name].str.contains(query, case=False))
230
- ]
231
- else:
232
- filtered_df = df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False))]
233
-
234
- return filtered_df
235
 
236
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
237
  always_here_cols = [
 
216
  # Searching and filtering
217
  def update_table(hidden_df: pd.DataFrame, current_columns_df: pd.DataFrame, columns: list, type_query: list, size_query: list, show_deleted: bool, query: str):
218
  filtered_df = filter_models(hidden_df, type_query, size_query, show_deleted)
219
+ if query != "":
220
+ filtered_df = search_table(filtered_df, query)
221
+ df = select_columns(filtered_df, columns)
222
 
223
  return df
224
 
225
+ def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
226
+ return df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False))]
 
 
 
 
 
 
 
 
 
227
 
228
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
229
  always_here_cols = [