Zipeng365 commited on
Commit
2b6bbb9
·
verified ·
1 Parent(s): 065d79c

Polish leaderboard table layout

Browse files
Files changed (1) hide show
  1. app.py +24 -18
app.py CHANGED
@@ -241,23 +241,22 @@ def filter_table(view: str, metric: str, family: str, query: str, top_n: int):
241
  ascending = not HIGHER_IS_BETTER.get(metric, True)
242
  ranked = df.sort_values(metric, ascending=ascending, na_position="last").head(int(top_n))
243
 
244
- show_cols = [
245
- col
246
- for col in [
247
- "rank",
248
- "display_name",
249
- "method",
250
- "family",
251
- "dataset",
252
- metric,
253
- "mean_metric_rank",
254
- "overall_mean_rank",
255
- "coverage_success",
256
- "row_count",
257
- "setting_count",
258
- ]
259
- if col in ranked.columns
260
- ]
261
  remaining_metrics = [
262
  col
263
  for col in ranked.columns
@@ -394,7 +393,14 @@ with gr.Blocks(**BLOCKS_KWARGS) as demo:
394
 
395
  note = gr.Markdown()
396
  plot = gr.Plot()
397
- table = gr.Dataframe(label="Leaderboard table", wrap=True, interactive=False)
 
 
 
 
 
 
 
398
 
399
  inputs = [view, metric, family, query, top_n]
400
  for control in inputs:
 
241
  ascending = not HIGHER_IS_BETTER.get(metric, True)
242
  ranked = df.sort_values(metric, ascending=ascending, na_position="last").head(int(top_n))
243
 
244
+ show_cols = []
245
+ for col in [
246
+ "rank",
247
+ "display_name",
248
+ "method",
249
+ "family",
250
+ "dataset",
251
+ metric,
252
+ "mean_metric_rank",
253
+ "overall_mean_rank",
254
+ "coverage_success",
255
+ "row_count",
256
+ "setting_count",
257
+ ]:
258
+ if col in ranked.columns and col not in show_cols:
259
+ show_cols.append(col)
 
260
  remaining_metrics = [
261
  col
262
  for col in ranked.columns
 
393
 
394
  note = gr.Markdown()
395
  plot = gr.Plot()
396
+ table = gr.Dataframe(
397
+ label="Leaderboard table",
398
+ wrap=False,
399
+ interactive=False,
400
+ max_height=520,
401
+ column_widths=["72px", "230px", "220px", "150px", "140px", "150px"],
402
+ show_search="filter",
403
+ )
404
 
405
  inputs = [view, metric, family, query, top_n]
406
  for control in inputs: