openhands openhands commited on
Commit
fcb3d0b
Β·
1 Parent(s): 8a3a9eb

Multiple graph and table improvements

Browse files

- Removed 'Missing Cost Data' vertical divider line from graph
- Added log scale to x-axis (cost) for better data visualization
- Created custom SVG lock icons: blue open lock, red closed lock
- Replaced lock emojis with custom SVG lock icons in tables
- Made graph icons smaller for cleaner appearance
- Moved model name labels higher above icons using annotations

Co-authored-by: openhands <openhands@all-hands.dev>

assets/lock-closed.svg ADDED
assets/lock-open.svg ADDED
leaderboard_transformer.py CHANGED
@@ -581,9 +581,9 @@ def _plot_scatter_plotly(
581
  encoded_logo = base64.b64encode(f.read()).decode('utf-8')
582
  logo_uri = f"data:image/svg+xml;base64,{encoded_logo}"
583
 
584
- # Calculate logo size based on data range
585
- logo_size_x = max_reported_cost * 0.08 if max_reported_cost > 0 else 0.5
586
- logo_size_y = 4 # Fixed y size in data units
587
 
588
  # Add image at data point position, centered on the point
589
  layout_images.append(dict(
@@ -622,7 +622,7 @@ def _plot_scatter_plotly(
622
  model_name = model_name[:22] + '...'
623
  frontier_labels.append(model_name)
624
 
625
- # Add text labels for frontier points
626
  fig.add_trace(go.Scatter(
627
  x=frontier_x,
628
  y=frontier_y,
@@ -638,21 +638,33 @@ def _plot_scatter_plotly(
638
  ),
639
  hoverinfo='skip'
640
  ))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
641
 
642
  # --- Section 8: Configure Layout ---
643
- xaxis_config = dict(title=x_axis_label, rangemode="tozero")
644
- if divider_line_x > 0:
645
- fig.add_vline(
646
- x=divider_line_x,
647
- line_width=2,
648
- line_dash="dash",
649
- line_color="grey",
650
- annotation_text="Missing Cost Data",
651
- annotation_position="top right"
652
- )
653
-
654
- # ---Adjust x-axis range to make room for the new points ---
655
- xaxis_config['range'] = [-0.2, (max_reported_cost + (max_reported_cost / 4))]
656
 
657
 
658
  # Build layout configuration
@@ -660,7 +672,7 @@ def _plot_scatter_plotly(
660
  template="plotly_white",
661
  title=f"OpenHands Index {name} Leaderboard",
662
  xaxis=xaxis_config,
663
- yaxis=dict(title="Average (mean) score", range=[-0.2, None]),
664
  legend=dict(
665
  bgcolor='#FAF2E9',
666
  ),
 
581
  encoded_logo = base64.b64encode(f.read()).decode('utf-8')
582
  logo_uri = f"data:image/svg+xml;base64,{encoded_logo}"
583
 
584
+ # Calculate logo size - smaller icons
585
+ logo_size_x = max_reported_cost * 0.04 if max_reported_cost > 0 else 0.3
586
+ logo_size_y = 2.5 # Fixed y size in data units (smaller)
587
 
588
  # Add image at data point position, centered on the point
589
  layout_images.append(dict(
 
622
  model_name = model_name[:22] + '...'
623
  frontier_labels.append(model_name)
624
 
625
+ # Add text labels for frontier points - positioned above the icons
626
  fig.add_trace(go.Scatter(
627
  x=frontier_x,
628
  y=frontier_y,
 
638
  ),
639
  hoverinfo='skip'
640
  ))
641
+
642
+ # Add annotations for each frontier label with higher y-offset
643
+ for i, (x_val, y_val, label) in enumerate(zip(frontier_x, frontier_y, frontier_labels)):
644
+ fig.add_annotation(
645
+ x=x_val,
646
+ y=y_val,
647
+ text=label,
648
+ showarrow=False,
649
+ yshift=25, # Move label higher above the icon
650
+ font=dict(
651
+ size=10,
652
+ color='#032629',
653
+ family='Manrope'
654
+ ),
655
+ xanchor='center',
656
+ yanchor='bottom'
657
+ )
658
+
659
+ # Remove the scatter trace we just added (we're using annotations instead)
660
+ fig.data = fig.data[:-1]
661
 
662
  # --- Section 8: Configure Layout ---
663
+ xaxis_config = dict(
664
+ title=x_axis_label,
665
+ type="log", # Use logarithmic scale for cost
666
+ rangemode="tozero"
667
+ )
 
 
 
 
 
 
 
 
668
 
669
 
670
  # Build layout configuration
 
672
  template="plotly_white",
673
  title=f"OpenHands Index {name} Leaderboard",
674
  xaxis=xaxis_config,
675
+ yaxis=dict(title="Average (mean) score"),
676
  legend=dict(
677
  bgcolor='#FAF2E9',
678
  ),
ui_components.py CHANGED
@@ -156,21 +156,23 @@ def create_svg_html(value, svg_map):
156
 
157
  def build_openness_tooltip_content() -> str:
158
  """
159
- Generates the inner HTML for the Model Openness tooltip card using lock emojis.
160
  """
 
 
161
  html_items = [
162
- """
163
  <div class="tooltip-legend-item">
164
- <span style="font-size: 24px;">πŸ”“</span>
165
  <div>
166
  <strong>Open</strong>
167
  <span>Open source model</span>
168
  </div>
169
  </div>
170
  """,
171
- """
172
  <div class="tooltip-legend-item">
173
- <span style="font-size: 24px;">πŸ”’</span>
174
  <div>
175
  <strong>Closed</strong>
176
  <span>Closed source model</span>
@@ -255,16 +257,18 @@ def build_descriptions_tooltip_content(table) -> str:
255
  <div class="tooltip-description-item"><b>Logs:</b> View evaluation run logs (e.g., outputs, traces).</div>
256
  """
257
 
258
- # Create HTML for the "Openness" legend items for table using lock emojis
 
 
259
  openness_html_items = [
260
- '<div style="display: flex; align-items: center; white-space: nowrap;">'
261
- '<span style="font-size: 16px; margin-right: 4px;">πŸ”“</span>'
262
- '<span>Open</span>'
263
- '</div>',
264
- '<div style="display: flex; align-items: center; white-space: nowrap;">'
265
- '<span style="font-size: 16px; margin-right: 4px;">πŸ”’</span>'
266
- '<span>Closed</span>'
267
- '</div>'
268
  ]
269
  openness_html = " ".join(openness_html_items)
270
 
@@ -452,11 +456,13 @@ def create_leaderboard_display(
452
 
453
  def get_openness_icon_html(row):
454
  openness_val = row.get('Openness', '')
455
- # Use lock emojis: πŸ”“ for open, πŸ”’ for closed
456
  if openness_val in [aliases.CANONICAL_OPENNESS_OPEN, 'Open', 'Open Source', 'Open Source + Open Weights']:
457
- return '<span title="Open source model" style="font-size: 18px;">πŸ”“</span>'
 
458
  else:
459
- return '<span title="Closed source model" style="font-size: 18px;">πŸ”’</span>'
 
460
 
461
  df_display['Icon'] = df_display.apply(get_openness_icon_html, axis=1)
462
 
@@ -675,14 +681,16 @@ def create_benchmark_details_display(
675
  axis=1
676
  )
677
 
678
- # Create simple openness icons using lock emojis
679
  def get_openness_icon_html(row):
680
  openness_val = row.get('Openness', '')
681
- # Use lock emojis: πŸ”“ for open, πŸ”’ for closed
682
  if openness_val in [aliases.CANONICAL_OPENNESS_OPEN, 'Open', 'Open Source', 'Open Source + Open Weights']:
683
- return '<span title="Open source model" style="font-size: 18px;">πŸ”“</span>'
 
684
  else:
685
- return '<span title="Closed source model" style="font-size: 18px;">πŸ”’</span>'
 
686
 
687
  benchmark_table_df['Icon'] = benchmark_table_df.apply(get_openness_icon_html, axis=1)
688
 
 
156
 
157
  def build_openness_tooltip_content() -> str:
158
  """
159
+ Generates the inner HTML for the Model Openness tooltip card using custom SVG lock icons.
160
  """
161
+ open_uri = get_svg_as_data_uri("assets/lock-open.svg")
162
+ closed_uri = get_svg_as_data_uri("assets/lock-closed.svg")
163
  html_items = [
164
+ f"""
165
  <div class="tooltip-legend-item">
166
+ <img src="{open_uri}" alt="Open" style="width: 24px; height: 24px;">
167
  <div>
168
  <strong>Open</strong>
169
  <span>Open source model</span>
170
  </div>
171
  </div>
172
  """,
173
+ f"""
174
  <div class="tooltip-legend-item">
175
+ <img src="{closed_uri}" alt="Closed" style="width: 24px; height: 24px;">
176
  <div>
177
  <strong>Closed</strong>
178
  <span>Closed source model</span>
 
257
  <div class="tooltip-description-item"><b>Logs:</b> View evaluation run logs (e.g., outputs, traces).</div>
258
  """
259
 
260
+ # Create HTML for the "Openness" legend items for table using custom SVG lock icons
261
+ open_lock_uri = get_svg_as_data_uri("assets/lock-open.svg")
262
+ closed_lock_uri = get_svg_as_data_uri("assets/lock-closed.svg")
263
  openness_html_items = [
264
+ f'<div style="display: flex; align-items: center; white-space: nowrap;">'
265
+ f'<img src="{open_lock_uri}" alt="Open" style="width:16px; height:16px; margin-right: 4px;">'
266
+ f'<span>Open</span>'
267
+ f'</div>',
268
+ f'<div style="display: flex; align-items: center; white-space: nowrap;">'
269
+ f'<img src="{closed_lock_uri}" alt="Closed" style="width:16px; height:16px; margin-right: 4px;">'
270
+ f'<span>Closed</span>'
271
+ f'</div>'
272
  ]
273
  openness_html = " ".join(openness_html_items)
274
 
 
456
 
457
  def get_openness_icon_html(row):
458
  openness_val = row.get('Openness', '')
459
+ # Use custom lock SVG icons: blue open lock, red closed lock
460
  if openness_val in [aliases.CANONICAL_OPENNESS_OPEN, 'Open', 'Open Source', 'Open Source + Open Weights']:
461
+ uri = get_svg_as_data_uri("assets/lock-open.svg")
462
+ return f'<img src="{uri}" alt="Open" title="Open source model" style="width:20px; height:20px;">'
463
  else:
464
+ uri = get_svg_as_data_uri("assets/lock-closed.svg")
465
+ return f'<img src="{uri}" alt="Closed" title="Closed source model" style="width:20px; height:20px;">'
466
 
467
  df_display['Icon'] = df_display.apply(get_openness_icon_html, axis=1)
468
 
 
681
  axis=1
682
  )
683
 
684
+ # Create simple openness icons using custom SVG lock icons
685
  def get_openness_icon_html(row):
686
  openness_val = row.get('Openness', '')
687
+ # Use custom lock SVG icons: blue open lock, red closed lock
688
  if openness_val in [aliases.CANONICAL_OPENNESS_OPEN, 'Open', 'Open Source', 'Open Source + Open Weights']:
689
+ uri = get_svg_as_data_uri("assets/lock-open.svg")
690
+ return f'<img src="{uri}" alt="Open" title="Open source model" style="width:20px; height:20px;">'
691
  else:
692
+ uri = get_svg_as_data_uri("assets/lock-closed.svg")
693
+ return f'<img src="{uri}" alt="Closed" title="Closed source model" style="width:20px; height:20px;">'
694
 
695
  benchmark_table_df['Icon'] = benchmark_table_df.apply(get_openness_icon_html, axis=1)
696