Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -340,15 +340,14 @@ with demo:
|
|
340 |
leaderboard_df_filtered = pd.DataFrame(records)
|
341 |
|
342 |
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
print(f"'
|
348 |
-
print(f"'Type' カラムのユニーク値: {leaderboard_df_filtered['Type'].unique()}")
|
349 |
|
350 |
-
# '
|
351 |
-
leaderboard_df_filtered['
|
352 |
|
353 |
# 'COLS' リストから 'T' と 'Model' を除外
|
354 |
if 'T' in COLS:
|
@@ -366,25 +365,32 @@ with demo:
|
|
366 |
else:
|
367 |
datatype_dict[col] = "str" # デフォルトのデータ型
|
368 |
|
369 |
-
# '
|
370 |
-
if '
|
371 |
-
print("Warning: '
|
372 |
-
datatype_dict['
|
373 |
|
374 |
# デバッグ用出力
|
375 |
-
print("Datatype dictionary after renaming 'T' to '
|
376 |
print("Preview of leaderboard_df_filtered after renaming:")
|
377 |
print(leaderboard_df_filtered.head())
|
378 |
|
379 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
leaderboard_table = gr.components.Dataframe(
|
381 |
-
value=leaderboard_df_filtered
|
382 |
-
|
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(
|
|
|
340 |
leaderboard_df_filtered = pd.DataFrame(records)
|
341 |
|
342 |
|
343 |
+
leaderboard_df_filtered = leaderboard_df_filtered.rename(columns={'T': 'Type_'})
|
344 |
+
|
345 |
+
# 'Type_' カラムのデータ型と内容を確認
|
346 |
+
print(f"'Type_' カラムのデータ型: {leaderboard_df_filtered['Type_'].dtype}")
|
347 |
+
print(f"'Type_' カラムのユニーク値: {leaderboard_df_filtered['Type_'].unique()}")
|
|
|
348 |
|
349 |
+
# 'Type_' カラムを文字列型に変換
|
350 |
+
leaderboard_df_filtered['Type_'] = leaderboard_df_filtered['Type_'].astype(str)
|
351 |
|
352 |
# 'COLS' リストから 'T' と 'Model' を除外
|
353 |
if 'T' in COLS:
|
|
|
365 |
else:
|
366 |
datatype_dict[col] = "str" # デフォルトのデータ型
|
367 |
|
368 |
+
# 'Type_' が 'datatype_dict' に含まれているか確認
|
369 |
+
if 'Type_' not in datatype_dict:
|
370 |
+
print("Warning: 'Type_' column not found in TYPES. Setting its datatype to 'str'.")
|
371 |
+
datatype_dict['Type_'] = "str"
|
372 |
|
373 |
# デバッグ用出力
|
374 |
+
print("Datatype dictionary after renaming 'T' to 'Type_':", datatype_dict)
|
375 |
print("Preview of leaderboard_df_filtered after renaming:")
|
376 |
print(leaderboard_df_filtered.head())
|
377 |
|
378 |
+
# カラム名を確認してスペースや特殊文字がないか確認
|
379 |
+
print([f"'{c}'" for c in leaderboard_df_filtered.columns])
|
380 |
+
|
381 |
+
# 'Type_' カラムのデータ型とユニーク値を再確認
|
382 |
+
print(f"'Type_' カラムのデータ型: {leaderboard_df_filtered['Type_'].dtype}")
|
383 |
+
print(f"'Type_' カラムのユニーク値: {leaderboard_df_filtered['Type_'].unique()}")
|
384 |
+
|
385 |
+
# Gradio Dataframe コンポーネントの初期化(datatype を省略)
|
386 |
leaderboard_table = gr.components.Dataframe(
|
387 |
+
value=leaderboard_df_filtered,
|
388 |
+
# datatype=datatype_dict, # 一時的にコメントアウト
|
|
|
389 |
elem_id="leaderboard-table",
|
390 |
interactive=False,
|
391 |
visible=True,
|
392 |
)
|
393 |
+
|
394 |
|
395 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
396 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|