Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -132,7 +132,8 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
|
132 |
if c not in seen:
|
133 |
unique_columns.append(c)
|
134 |
seen.add(c)
|
135 |
-
|
|
|
136 |
filtered_df = df[unique_columns]
|
137 |
return filtered_df
|
138 |
|
@@ -355,15 +356,16 @@ with demo:
|
|
355 |
if 'Model' in COLS:
|
356 |
COLS.remove('Model')
|
357 |
|
358 |
-
#
|
359 |
datatype_dict = {}
|
360 |
for col in leaderboard_df_filtered.columns:
|
361 |
if col == 'Model':
|
362 |
-
datatype_dict[col] = "markdown
|
363 |
elif col in TYPES:
|
364 |
datatype_dict[col] = TYPES[col]
|
365 |
else:
|
366 |
datatype_dict[col] = "str" # デフォルトのデータ型
|
|
|
367 |
|
368 |
# 'Type_' が 'datatype_dict' に含まれているか確認
|
369 |
if 'Type_' not in datatype_dict:
|
@@ -382,10 +384,11 @@ with demo:
|
|
382 |
print(f"'Type_' カラムのデータ型: {leaderboard_df_filtered['Type_'].dtype}")
|
383 |
print(f"'Type_' カラムのユニーク値: {leaderboard_df_filtered['Type_'].unique()}")
|
384 |
|
385 |
-
# Gradio Dataframe
|
386 |
leaderboard_table = gr.components.Dataframe(
|
387 |
-
value=leaderboard_df_filtered,
|
388 |
-
|
|
|
389 |
elem_id="leaderboard-table",
|
390 |
interactive=False,
|
391 |
visible=True,
|
|
|
132 |
if c not in seen:
|
133 |
unique_columns.append(c)
|
134 |
seen.add(c)
|
135 |
+
if AutoEvalColumn.model.name not in unique_columns:
|
136 |
+
unique_columns.insert(1, AutoEvalColumn.model.name) # Type_の次にModelを挿入
|
137 |
filtered_df = df[unique_columns]
|
138 |
return filtered_df
|
139 |
|
|
|
356 |
if 'Model' in COLS:
|
357 |
COLS.remove('Model')
|
358 |
|
359 |
+
# datatypeを準備
|
360 |
datatype_dict = {}
|
361 |
for col in leaderboard_df_filtered.columns:
|
362 |
if col == 'Model':
|
363 |
+
datatype_dict[col] = "str" # markdownからstrに変更
|
364 |
elif col in TYPES:
|
365 |
datatype_dict[col] = TYPES[col]
|
366 |
else:
|
367 |
datatype_dict[col] = "str" # デフォルトのデータ型
|
368 |
+
|
369 |
|
370 |
# 'Type_' が 'datatype_dict' に含まれているか確認
|
371 |
if 'Type_' not in datatype_dict:
|
|
|
384 |
print(f"'Type_' カラムのデータ型: {leaderboard_df_filtered['Type_'].dtype}")
|
385 |
print(f"'Type_' カラムのユニーク値: {leaderboard_df_filtered['Type_'].unique()}")
|
386 |
|
387 |
+
# Gradio Dataframe コンポーネントの初期化
|
388 |
leaderboard_table = gr.components.Dataframe(
|
389 |
+
value=leaderboard_df_filtered.to_dict('records'),
|
390 |
+
headers=list(leaderboard_df_filtered.columns),
|
391 |
+
datatype=datatype_dict,
|
392 |
elem_id="leaderboard-table",
|
393 |
interactive=False,
|
394 |
visible=True,
|