hysts HF staff commited on
Commit
676db2b
1 Parent(s): 54674a9
Files changed (1) hide show
  1. app.py +29 -27
app.py CHANGED
@@ -209,8 +209,37 @@ def filter_models(
209
  return filtered_df
210
 
211
 
 
 
212
  leaderboard_df = filter_models(leaderboard_df, [t.to_str(" : ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  # Leaderboard demo
215
 
216
  with gr.Blocks() as demo_leaderboard:
@@ -286,33 +315,6 @@ with gr.Blocks() as demo_leaderboard:
286
  elem_id="filter-columns-num-few-shots",
287
  )
288
 
289
- leaderboard_df_filtered = filter_models(leaderboard_df, [t.to_str(" : ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
290
- # initial_columns = [c.name for c in fields(AutoEvalColumn) if c.never_hidden or c.displayed_by_default]
291
- # leaderboard_df_filtered = select_columns(leaderboard_df_filtered, initial_columns)
292
-
293
- # leaderboard_table = gr.Dataframe(
294
- # value=leaderboard_df_filtered,
295
- # headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
296
- # datatype=TYPES,
297
- # elem_id="leaderboard-table",
298
- # interactive=False,
299
- # visible=True,
300
- # )
301
-
302
- # DataFrameの初期化部分のみを修正
303
- initial_columns = ['T'] + [c.name for c in fields(AutoEvalColumn) if (c.never_hidden or c.displayed_by_default) and c.name != 'T']
304
- leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
305
-
306
- # Model列のリンク形式を修正
307
- leaderboard_df_filtered['Model'] = leaderboard_df_filtered['Model'].apply(
308
- 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
309
- )
310
-
311
- # 数値データを文字列に変換
312
- for col in leaderboard_df_filtered.columns:
313
- if col not in ['T', 'Model']:
314
- leaderboard_df_filtered[col] = leaderboard_df_filtered[col].astype(str)
315
-
316
  # DataFrameコンポーネントの初期化
317
  leaderboard_table = gr.Dataframe(
318
  value=leaderboard_df_filtered,
 
209
  return filtered_df
210
 
211
 
212
+ # Prepare leaderboard dataframes
213
+
214
  leaderboard_df = filter_models(leaderboard_df, [t.to_str(" : ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
215
 
216
+ leaderboard_df_filtered = filter_models(leaderboard_df, [t.to_str(" : ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
217
+ # initial_columns = [c.name for c in fields(AutoEvalColumn) if c.never_hidden or c.displayed_by_default]
218
+ # leaderboard_df_filtered = select_columns(leaderboard_df_filtered, initial_columns)
219
+
220
+ # leaderboard_table = gr.Dataframe(
221
+ # value=leaderboard_df_filtered,
222
+ # headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
223
+ # datatype=TYPES,
224
+ # elem_id="leaderboard-table",
225
+ # interactive=False,
226
+ # visible=True,
227
+ # )
228
+
229
+ # DataFrameの初期化部分のみを修正
230
+ initial_columns = ['T'] + [c.name for c in fields(AutoEvalColumn) if (c.never_hidden or c.displayed_by_default) and c.name != 'T']
231
+ leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
232
+
233
+ # Model列のリンク形式を修正
234
+ leaderboard_df_filtered['Model'] = leaderboard_df_filtered['Model'].apply(
235
+ 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
236
+ )
237
+
238
+ # 数値データを文字列に変換
239
+ for col in leaderboard_df_filtered.columns:
240
+ if col not in ['T', 'Model']:
241
+ leaderboard_df_filtered[col] = leaderboard_df_filtered[col].astype(str)
242
+
243
  # Leaderboard demo
244
 
245
  with gr.Blocks() as demo_leaderboard:
 
315
  elem_id="filter-columns-num-few-shots",
316
  )
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  # DataFrameコンポーネントの初期化
319
  leaderboard_table = gr.Dataframe(
320
  value=leaderboard_df_filtered,