Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -105,14 +105,27 @@ def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
|
|
105 |
return df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False))]
|
106 |
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
109 |
always_here_cols = [
|
110 |
AutoEvalColumn.model_type_symbol.name,
|
111 |
AutoEvalColumn.model.name,
|
112 |
]
|
113 |
-
#
|
|
|
|
|
114 |
filtered_df = df[
|
115 |
-
always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
116 |
]
|
117 |
return filtered_df
|
118 |
|
@@ -277,16 +290,6 @@ with demo:
|
|
277 |
|
278 |
print("Columns in leaderboard_df_filtered:", leaderboard_df_filtered.columns)
|
279 |
|
280 |
-
# datatypeを準備
|
281 |
-
datatype_dict = {}
|
282 |
-
for col in leaderboard_df_filtered.columns:
|
283 |
-
if col == AutoEvalColumn.model.name:
|
284 |
-
datatype_dict[col] = "markdown"
|
285 |
-
elif col in TYPES:
|
286 |
-
datatype_dict[col] = TYPES[col]
|
287 |
-
else:
|
288 |
-
datatype_dict[col] = "str"
|
289 |
-
|
290 |
# leaderboard_tableの初期化
|
291 |
leaderboard_table = gr.components.Dataframe(
|
292 |
value=leaderboard_df_filtered.to_dict('records'),
|
|
|
105 |
return df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False))]
|
106 |
|
107 |
|
108 |
+
# def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
109 |
+
# always_here_cols = [
|
110 |
+
# AutoEvalColumn.model_type_symbol.name,
|
111 |
+
# AutoEvalColumn.model.name,
|
112 |
+
# ]
|
113 |
+
# # We use COLS to maintain sorting
|
114 |
+
# filtered_df = df[
|
115 |
+
# always_here_cols + [c for c in COLS if c in df.columns and c in columns]# + [AutoEvalColumn.dummy.name]
|
116 |
+
# ]
|
117 |
+
# return filtered_df
|
118 |
+
|
119 |
def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
120 |
always_here_cols = [
|
121 |
AutoEvalColumn.model_type_symbol.name,
|
122 |
AutoEvalColumn.model.name,
|
123 |
]
|
124 |
+
# always_here_cols が既に columns に含まれている場合は除外
|
125 |
+
columns = [c for c in columns if c not in always_here_cols]
|
126 |
+
# COLS の順序を維持しつつ、重複を避けてカラムを選択
|
127 |
filtered_df = df[
|
128 |
+
always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
129 |
]
|
130 |
return filtered_df
|
131 |
|
|
|
290 |
|
291 |
print("Columns in leaderboard_df_filtered:", leaderboard_df_filtered.columns)
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
# leaderboard_tableの初期化
|
294 |
leaderboard_table = gr.components.Dataframe(
|
295 |
value=leaderboard_df_filtered.to_dict('records'),
|