sh1gechan commited on
Commit
abfc8cc
·
verified ·
1 Parent(s): 0e1e133

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -121,9 +121,9 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
121
  AutoEvalColumn.model_type_symbol.name, # 'T'
122
  AutoEvalColumn.model.name, # 'Model'
123
  ]
 
124
  # 'always_here_cols' を 'columns' から除外して重複を避ける
125
  columns = [c for c in columns if c not in always_here_cols]
126
- # 'always_here_cols' を先頭に追加し、その他のカラムを COLS の順序で追加
127
  new_columns = always_here_cols + [c for c in COLS if c in df.columns and c in columns]
128
 
129
  # 重複を排除しつつ順序を維持
@@ -134,9 +134,9 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
134
  unique_columns.append(c)
135
  seen.add(c)
136
 
137
- # 'Model' カラムがHTMLリンクでなく、プレーンテキストの場合を保持する
138
  if 'Model' in df.columns:
139
- df['Model'] = df['Model'].apply(lambda x: x if isinstance(x, str) and '<a' not in x else '')
140
 
141
  # フィルタリングされたカラムでデータフレームを作成
142
  filtered_df = df[unique_columns]
@@ -144,6 +144,7 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
144
 
145
 
146
 
 
147
  def filter_queries(query: str, filtered_df: pd.DataFrame):
148
  """Added by Abishek"""
149
  final_df = []
@@ -301,7 +302,13 @@ with demo:
301
  # )
302
 
303
  initial_columns = [c.name for c in fields(AutoEvalColumn) if c.never_hidden or c.displayed_by_default]
 
 
 
304
  leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
 
 
 
305
 
306
  # 重複カラムの確認と削除
307
  duplicate_columns = leaderboard_df_filtered.columns[leaderboard_df_filtered.columns.duplicated()]
 
121
  AutoEvalColumn.model_type_symbol.name, # 'T'
122
  AutoEvalColumn.model.name, # 'Model'
123
  ]
124
+
125
  # 'always_here_cols' を 'columns' から除外して重複を避ける
126
  columns = [c for c in columns if c not in always_here_cols]
 
127
  new_columns = always_here_cols + [c for c in COLS if c in df.columns and c in columns]
128
 
129
  # 重複を排除しつつ順序を維持
 
134
  unique_columns.append(c)
135
  seen.add(c)
136
 
137
+ # 'Model' カラムがHTMLリンクでなく、プレーンテキストの場合を保持
138
  if 'Model' in df.columns:
139
+ df['Model'] = df['Model'].apply(lambda x: x if isinstance(x, str) and '<a' not in x else 'モデル名が表示されません')
140
 
141
  # フィルタリングされたカラムでデータフレームを作成
142
  filtered_df = df[unique_columns]
 
144
 
145
 
146
 
147
+
148
  def filter_queries(query: str, filtered_df: pd.DataFrame):
149
  """Added by Abishek"""
150
  final_df = []
 
302
  # )
303
 
304
  initial_columns = [c.name for c in fields(AutoEvalColumn) if c.never_hidden or c.displayed_by_default]
305
+ # データの状態を確認するための print 文を追加
306
+ print("Before select_columns:")
307
+ print(df['Model'].head()) # select_columns 呼び出し前に 'Model' 列を確認
308
  leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
309
+ # select_columns 後に再度 'Model' 列を確認
310
+ print("After select_columns:")
311
+ print(filtered_df['Model'].head())
312
 
313
  # 重複カラムの確認と削除
314
  duplicate_columns = leaderboard_df_filtered.columns[leaderboard_df_filtered.columns.duplicated()]