Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -340,25 +340,51 @@ with demo:
|
|
340 |
leaderboard_df_filtered = pd.DataFrame(records)
|
341 |
|
342 |
|
343 |
-
#
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
-
#
|
347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
print(leaderboard_df_filtered.head())
|
349 |
|
350 |
# Gradio Dataframe コンポーネントの初期化
|
351 |
leaderboard_table = gr.components.Dataframe(
|
352 |
value=leaderboard_df_filtered.to_dict('records'),
|
353 |
headers=list(leaderboard_df_filtered.columns),
|
354 |
-
datatype=datatype_dict,
|
355 |
elem_id="leaderboard-table",
|
356 |
interactive=False,
|
357 |
visible=True,
|
358 |
)
|
359 |
-
|
360 |
-
print("Datatype dictionary:", datatype_dict)
|
361 |
-
print("Leaderboard table headers:", leaderboard_table.headers)
|
362 |
|
363 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
364 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
|
|
340 |
leaderboard_df_filtered = pd.DataFrame(records)
|
341 |
|
342 |
|
343 |
+
# 'T' カラムを 'Type' にリネーム
|
344 |
+
leaderboard_df_filtered = leaderboard_df_filtered.rename(columns={'T': 'Type'})
|
345 |
+
|
346 |
+
# 'Type' カラムのデータ型と内容を確認
|
347 |
+
print(f"'Type' カラムのデータ型: {leaderboard_df_filtered['Type'].dtype}")
|
348 |
+
print(f"'Type' カラムのユニーク値: {leaderboard_df_filtered['Type'].unique()}")
|
349 |
+
|
350 |
+
# 'Type' カラムを文字列型に変換
|
351 |
+
leaderboard_df_filtered['Type'] = leaderboard_df_filtered['Type'].astype(str)
|
352 |
+
|
353 |
+
# 'COLS' リストから 'T' と 'Model' を除外
|
354 |
+
if 'T' in COLS:
|
355 |
+
COLS.remove('T')
|
356 |
+
if 'Model' in COLS:
|
357 |
+
COLS.remove('Model')
|
358 |
|
359 |
+
# 'datatype_dict' を再定義
|
360 |
+
datatype_dict = {}
|
361 |
+
for col in leaderboard_df_filtered.columns:
|
362 |
+
if col == 'Model':
|
363 |
+
datatype_dict[col] = "markdown"
|
364 |
+
elif col in TYPES:
|
365 |
+
datatype_dict[col] = TYPES[col]
|
366 |
+
else:
|
367 |
+
datatype_dict[col] = "str" # デフォルトのデータ型
|
368 |
+
|
369 |
+
# 'Type' が 'datatype_dict' に含まれているか確認
|
370 |
+
if 'Type' not in datatype_dict:
|
371 |
+
print("Warning: 'Type' column not found in TYPES. Setting its datatype to 'str'.")
|
372 |
+
datatype_dict['Type'] = "str"
|
373 |
+
|
374 |
+
# デバッグ用出力
|
375 |
+
print("Datatype dictionary after renaming 'T' to 'Type':", datatype_dict)
|
376 |
+
print("Preview of leaderboard_df_filtered after renaming:")
|
377 |
print(leaderboard_df_filtered.head())
|
378 |
|
379 |
# Gradio Dataframe コンポーネントの初期化
|
380 |
leaderboard_table = gr.components.Dataframe(
|
381 |
value=leaderboard_df_filtered.to_dict('records'),
|
382 |
headers=list(leaderboard_df_filtered.columns),
|
383 |
+
datatype=datatype_dict, # 必要に応じてコメントアウト
|
384 |
elem_id="leaderboard-table",
|
385 |
interactive=False,
|
386 |
visible=True,
|
387 |
)
|
|
|
|
|
|
|
388 |
|
389 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
390 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|