kz209 commited on
Commit
190f867
Β·
1 Parent(s): 0b5fad3
Files changed (1) hide show
  1. pages/leaderboard.py +6 -9
pages/leaderboard.py CHANGED
@@ -14,19 +14,21 @@ css = '''
14
 
15
  .tooltip-wrapper .tooltip {
16
  visibility: hidden;
17
- width: 120px;
18
  background-color: black;
19
  color: #fff;
20
  text-align: center;
21
  border-radius: 6px;
22
- padding: 5px 0;
23
  position: absolute;
24
  z-index: 1;
25
  bottom: 125%;
26
  left: 50%;
27
- margin-left: -60px;
28
  opacity: 0;
29
  transition: opacity 0.3s;
 
 
30
  }
31
 
32
  .tooltip-wrapper:hover .tooltip {
@@ -74,10 +76,7 @@ def show_tooltip():
74
 
75
 
76
  def update_leaderboard(sort_by):
77
- # In a real implementation, this would filter the data based on the category
78
  sorted_df = df.sort_values(by=sort_by, ascending=False, ignore_index=True)
79
-
80
- # Update ranks based on new sorting
81
  sorted_df['Rank'] = range(1, len(sorted_df) + 1)
82
 
83
  # Create hover effect for Methods column
@@ -86,10 +85,8 @@ def update_leaderboard(sort_by):
86
  # Drop the 'Prompts' column as we don't want to display it directly
87
  sorted_df = sorted_df.drop(columns=['Prompts'])
88
 
89
- # Convert DataFrame to HTML with clickable headers for sorting
90
  html = sorted_df.to_html(index=False, escape=False)
91
 
92
- # Add sorting links to column headers
93
  for column in sorted_df.columns:
94
  html = html.replace(f'<th>{column}</th>',
95
  f'<th><a href="#" onclick="sortBy(\'{column}\'); return false;">{column}</a></th>')
@@ -97,7 +94,7 @@ def update_leaderboard(sort_by):
97
  return html
98
 
99
  def create_leaderboard():
100
- with gr.Blocks(css=custom_css) as demo:
101
  gr.Markdown("# πŸ† Summarization Arena Leaderboard")
102
 
103
  with gr.Row():
 
14
 
15
  .tooltip-wrapper .tooltip {
16
  visibility: hidden;
17
+ width: 300px; # Increased width for longer prompts
18
  background-color: black;
19
  color: #fff;
20
  text-align: center;
21
  border-radius: 6px;
22
+ padding: 5px;
23
  position: absolute;
24
  z-index: 1;
25
  bottom: 125%;
26
  left: 50%;
27
+ margin-left: -150px; # Adjusted for new width
28
  opacity: 0;
29
  transition: opacity 0.3s;
30
+ white-space: pre-wrap; # This allows text wrapping
31
+ word-wrap: break-word; # This ensures long words don't overflow
32
  }
33
 
34
  .tooltip-wrapper:hover .tooltip {
 
76
 
77
 
78
  def update_leaderboard(sort_by):
 
79
  sorted_df = df.sort_values(by=sort_by, ascending=False, ignore_index=True)
 
 
80
  sorted_df['Rank'] = range(1, len(sorted_df) + 1)
81
 
82
  # Create hover effect for Methods column
 
85
  # Drop the 'Prompts' column as we don't want to display it directly
86
  sorted_df = sorted_df.drop(columns=['Prompts'])
87
 
 
88
  html = sorted_df.to_html(index=False, escape=False)
89
 
 
90
  for column in sorted_df.columns:
91
  html = html.replace(f'<th>{column}</th>',
92
  f'<th><a href="#" onclick="sortBy(\'{column}\'); return false;">{column}</a></th>')
 
94
  return html
95
 
96
  def create_leaderboard():
97
+ with gr.Blocks(css=css) as demo:
98
  gr.Markdown("# πŸ† Summarization Arena Leaderboard")
99
 
100
  with gr.Row():