Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -300,51 +300,29 @@ with demo:
|
|
300 |
# visible=True,
|
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 |
-
|
308 |
-
|
309 |
-
|
310 |
-
# データ型を定義
|
311 |
-
datatype = {col: "str" for col in leaderboard_df_filtered.columns}
|
312 |
-
datatype['Model'] = "markdown"
|
313 |
-
datatype['T'] = "str"
|
314 |
-
|
315 |
-
# 'T' カラムを文字列型に変換
|
316 |
-
leaderboard_df_filtered.loc[:, 'T'] = leaderboard_df_filtered['T'].astype(str)
|
317 |
-
|
318 |
-
# デバッグ用の出力
|
319 |
-
print("Columns in leaderboard_df_filtered:", leaderboard_df_filtered.columns)
|
320 |
-
print("First few rows of leaderboard_df_filtered:")
|
321 |
-
print(leaderboard_df_filtered.head())
|
322 |
-
|
323 |
-
# データフレームを辞書に変換
|
324 |
-
df_dict = leaderboard_df_filtered.to_dict('records')
|
325 |
|
326 |
-
#
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
print(list(df_dict[0].keys()))
|
331 |
|
332 |
-
#
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
)
|
342 |
-
print("Dataframe component initialized successfully")
|
343 |
-
except Exception as e:
|
344 |
-
print(f"Error initializing Dataframe component: {str(e)}")
|
345 |
-
print("datatype dictionary:")
|
346 |
-
print(datatype)
|
347 |
-
raise
|
348 |
|
349 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
350 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
|
|
300 |
# visible=True,
|
301 |
# )
|
302 |
|
303 |
+
# DataFrameの初期化部分のみを修正
|
304 |
initial_columns = [c.name for c in fields(AutoEvalColumn) if c.never_hidden or c.displayed_by_default]
|
305 |
+
leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
|
306 |
|
307 |
+
# Model列のリンク形式を修正
|
308 |
+
leaderboard_df_filtered['Model'] = leaderboard_df_filtered['Model'].apply(
|
309 |
+
lambda x: f'[{x.split(">")[-2].split("<")[0]}]({x.split("href=")[1].split(chr(34))[1]})' if isinstance(x, str) and 'href=' in x else x
|
310 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
+
# 数値データを文字列に変換
|
313 |
+
for col in leaderboard_df_filtered.columns:
|
314 |
+
if col not in ['T', 'Model']:
|
315 |
+
leaderboard_df_filtered[col] = leaderboard_df_filtered[col].astype(str)
|
|
|
316 |
|
317 |
+
# DataFrameコンポーネントの初期化
|
318 |
+
leaderboard_table = gr.components.Dataframe(
|
319 |
+
value=leaderboard_df_filtered.to_dict('records'),
|
320 |
+
headers=list(leaderboard_df_filtered.columns),
|
321 |
+
datatype={col: "markdown" if col == "Model" else "str" for col in leaderboard_df_filtered.columns},
|
322 |
+
elem_id="leaderboard-table",
|
323 |
+
interactive=False,
|
324 |
+
visible=True
|
325 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
328 |
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|