kz209 commited on
Commit
6f65006
Β·
1 Parent(s): 60d569f
Files changed (1) hide show
  1. pages/leaderboard.py +10 -10
pages/leaderboard.py CHANGED
@@ -16,35 +16,35 @@ df = pd.DataFrame(data)
16
  def update_leaderboard(sort_by):
17
  # In a real implementation, this would filter the data based on the category
18
  sorted_df = df.sort_values(by=sort_by, ascending=False)
19
-
20
  # Update ranks based on new sorting
21
  sorted_df['Rank'] = range(1, len(sorted_df) + 1)
22
-
23
  # Convert DataFrame to HTML with clickable headers for sorting
24
  html = sorted_df.to_html(index=False, escape=False)
25
-
26
  # Add sorting links to column headers
27
  for column in sorted_df.columns:
28
  html = html.replace(f'<th>{column}</th>',
29
  f'<th><a href="#" onclick="sortBy(\'{column}\'); return false;">{column}</a></th>')
30
-
31
  return html
32
 
33
  def create_leaderboard():
34
  with gr.Blocks(css="#leaderboard table { width: 100%; } #leaderboard th, #leaderboard td { padding: 8px; text-align: left; }") as demo:
35
  gr.Markdown("# πŸ† Chris-Project Summarization Arena Leaderboard")
36
-
37
  with gr.Row():
38
  gr.Markdown("[Blog](placeholder) | [GitHub](placeholder) | [Paper](placeholder) | [Dataset](placeholder) | [Twitter](placeholder) | [Discord](placeholder)")
39
-
40
  gr.Markdown("Welcome to our open platform for evaluating LLM summarization capabilities. We use the DATASET_NAME_PLACEHOLDER dataset to generate summaries with MODEL_NAME_PLACEHOLDER. These summaries are then evaluated by STRONGER_MODEL_NAME_PLACEHOLDER using the METRIC1_PLACEHOLDER and METRIC2_PLACEHOLDER metrics")
41
-
42
  sort_by = gr.Dropdown(list(df.columns), label="Sort by", value="Rank")
43
-
44
  gr.Markdown("**Performance**\n\n**methods**: 4, **questions**: 150")
45
-
46
  leaderboard = gr.HTML(update_leaderboard("Rank"), elem_id="leaderboard")
47
-
48
  sort_by.change(update_leaderboard, inputs=[sort_by], outputs=[leaderboard])
49
 
50
  return demo
 
16
  def update_leaderboard(sort_by):
17
  # In a real implementation, this would filter the data based on the category
18
  sorted_df = df.sort_values(by=sort_by, ascending=False)
19
+
20
  # Update ranks based on new sorting
21
  sorted_df['Rank'] = range(1, len(sorted_df) + 1)
22
+
23
  # Convert DataFrame to HTML with clickable headers for sorting
24
  html = sorted_df.to_html(index=False, escape=False)
25
+
26
  # Add sorting links to column headers
27
  for column in sorted_df.columns:
28
  html = html.replace(f'<th>{column}</th>',
29
  f'<th><a href="#" onclick="sortBy(\'{column}\'); return false;">{column}</a></th>')
30
+
31
  return html
32
 
33
  def create_leaderboard():
34
  with gr.Blocks(css="#leaderboard table { width: 100%; } #leaderboard th, #leaderboard td { padding: 8px; text-align: left; }") as demo:
35
  gr.Markdown("# πŸ† Chris-Project Summarization Arena Leaderboard")
36
+
37
  with gr.Row():
38
  gr.Markdown("[Blog](placeholder) | [GitHub](placeholder) | [Paper](placeholder) | [Dataset](placeholder) | [Twitter](placeholder) | [Discord](placeholder)")
39
+
40
  gr.Markdown("Welcome to our open platform for evaluating LLM summarization capabilities. We use the DATASET_NAME_PLACEHOLDER dataset to generate summaries with MODEL_NAME_PLACEHOLDER. These summaries are then evaluated by STRONGER_MODEL_NAME_PLACEHOLDER using the METRIC1_PLACEHOLDER and METRIC2_PLACEHOLDER metrics")
41
+
42
  sort_by = gr.Dropdown(list(df.columns), label="Sort by", value="Rank")
43
+
44
  gr.Markdown("**Performance**\n\n**methods**: 4, **questions**: 150")
45
+
46
  leaderboard = gr.HTML(update_leaderboard("Rank"), elem_id="leaderboard")
47
+
48
  sort_by.change(update_leaderboard, inputs=[sort_by], outputs=[leaderboard])
49
 
50
  return demo