openhands commited on
Commit
4b2f07d
·
1 Parent(s): d17eff0

Fix logo glow and change Size chart to use total parameters

Browse files

Logo glow fix:
- Changed from URI fragment (#openhands-logo) to MIME parameter (openhands=logo)
- MIME parameters are more reliably preserved in attribute selectors
- Updated CSS selectors to match the new pattern

Size chart fix:
- Changed x-axis from active parameters to total parameters
- Updated axis title to 'Parameters (Billions)'
- Simplified hover text to show just 'Parameters' instead of 'Total/Active'

Files changed (4) hide show
  1. content.py +8 -8
  2. leaderboard_transformer.py +4 -4
  3. main_page.py +1 -1
  4. visualizations.py +9 -19
content.py CHANGED
@@ -1145,20 +1145,20 @@ h3 .header-link-icon {
1145
 
1146
  /* Re-invert company logo images so they display correctly */
1147
  /* Also add a light gray circular glow behind them for visibility */
1148
- /* Exclude OpenHands logo (identified by #openhands-logo fragment in href) */
1149
- .dark .js-plotly-plot .layer-above image:not([href*="openhands-logo"]):not([xlink\\:href*="openhands-logo"]),
1150
- .dark .js-plotly-plot .imagelayer image:not([href*="openhands-logo"]):not([xlink\\:href*="openhands-logo"]) {
1151
  filter: invert(1) hue-rotate(180deg)
1152
  drop-shadow(0 0 12px rgba(160, 165, 180, 0.95))
1153
  drop-shadow(0 0 8px rgba(160, 165, 180, 0.9));
1154
  }
1155
 
1156
  /* OpenHands logo at bottom - no glow, just re-invert for dark mode */
1157
- /* The logo is identified by #openhands-logo fragment in the data URI */
1158
- .dark .js-plotly-plot .layer-above image[href*="openhands-logo"],
1159
- .dark .js-plotly-plot .layer-above image[xlink\\:href*="openhands-logo"],
1160
- .dark .js-plotly-plot .imagelayer image[href*="openhands-logo"],
1161
- .dark .js-plotly-plot .imagelayer image[xlink\\:href*="openhands-logo"] {
1162
  filter: invert(1) hue-rotate(180deg) !important;
1163
  }
1164
 
 
1145
 
1146
  /* Re-invert company logo images so they display correctly */
1147
  /* Also add a light gray circular glow behind them for visibility */
1148
+ /* Exclude OpenHands logo (identified by openhands=logo MIME parameter) */
1149
+ .dark .js-plotly-plot .layer-above image:not([href*="openhands=logo"]):not([xlink\\:href*="openhands=logo"]),
1150
+ .dark .js-plotly-plot .imagelayer image:not([href*="openhands=logo"]):not([xlink\\:href*="openhands=logo"]) {
1151
  filter: invert(1) hue-rotate(180deg)
1152
  drop-shadow(0 0 12px rgba(160, 165, 180, 0.95))
1153
  drop-shadow(0 0 8px rgba(160, 165, 180, 0.9));
1154
  }
1155
 
1156
  /* OpenHands logo at bottom - no glow, just re-invert for dark mode */
1157
+ /* The logo is identified by openhands=logo MIME parameter in the data URI */
1158
+ .dark .js-plotly-plot .layer-above image[href*="openhands=logo"],
1159
+ .dark .js-plotly-plot .layer-above image[xlink\\:href*="openhands=logo"],
1160
+ .dark .js-plotly-plot .imagelayer image[href*="openhands=logo"],
1161
+ .dark .js-plotly-plot .imagelayer image[xlink\\:href*="openhands=logo"] {
1162
  filter: invert(1) hue-rotate(180deg) !important;
1163
  }
1164
 
leaderboard_transformer.py CHANGED
@@ -65,16 +65,16 @@ URL_ANNOTATION = dict(
65
  def get_openhands_logo_image():
66
  """Get the OpenHands logo as a Plotly image dict for chart branding.
67
 
68
- Uses a special URI format with #openhands-logo fragment to allow CSS targeting.
69
- The fragment doesn't affect the image rendering but enables CSS selectors.
70
  """
71
  if os.path.exists(OPENHANDS_LOGO_PATH_LIGHT):
72
  try:
73
  with open(OPENHANDS_LOGO_PATH_LIGHT, "rb") as f:
74
  logo_data = base64.b64encode(f.read()).decode('utf-8')
75
- # Add #openhands-logo fragment to enable CSS targeting for dark mode handling
76
  return dict(
77
- source=f"data:image/png;base64,{logo_data}#openhands-logo",
78
  xref="paper",
79
  yref="paper",
80
  x=0,
 
65
  def get_openhands_logo_image():
66
  """Get the OpenHands logo as a Plotly image dict for chart branding.
67
 
68
+ Uses a special MIME type parameter (;openhands=logo) to allow CSS targeting.
69
+ This enables CSS attribute selectors to identify this specific image.
70
  """
71
  if os.path.exists(OPENHANDS_LOGO_PATH_LIGHT):
72
  try:
73
  with open(OPENHANDS_LOGO_PATH_LIGHT, "rb") as f:
74
  logo_data = base64.b64encode(f.read()).decode('utf-8')
75
+ # Add openhands=logo parameter to MIME type for CSS targeting
76
  return dict(
77
+ source=f"data:image/png;openhands=logo;base64,{logo_data}",
78
  xref="paper",
79
  yref="paper",
80
  x=0,
main_page.py CHANGED
@@ -78,7 +78,7 @@ def build_page():
78
 
79
  # Open Model Accuracy by Size Section (always shows open models only by design)
80
  gr.HTML('<h2>Open Model Accuracy by Size</h2>', elem_id="size-accuracy-header")
81
- gr.Markdown("Compare open-weights model performance against their parameter count. The x-axis shows active parameters (relevant for MoE models).")
82
 
83
  size_fig = create_accuracy_by_size_chart(test_df)
84
  gr.Plot(value=size_fig, elem_id="size-accuracy-chart")
 
78
 
79
  # Open Model Accuracy by Size Section (always shows open models only by design)
80
  gr.HTML('<h2>Open Model Accuracy by Size</h2>', elem_id="size-accuracy-header")
81
+ gr.Markdown("Compare open-weights model performance against their parameter count.")
82
 
83
  size_fig = create_accuracy_by_size_chart(test_df)
84
  gr.Plot(value=size_fig, elem_id="size-accuracy-chart")
visualizations.py CHANGED
@@ -66,16 +66,16 @@ URL_ANNOTATION = dict(
66
  def get_openhands_logo_image():
67
  """Get the OpenHands logo as a Plotly image dict for chart branding.
68
 
69
- Uses a special URI format with #openhands-logo fragment to allow CSS targeting.
70
- The fragment doesn't affect the image rendering but enables CSS selectors.
71
  """
72
  if os.path.exists(OPENHANDS_LOGO_PATH_LIGHT):
73
  try:
74
  with open(OPENHANDS_LOGO_PATH_LIGHT, "rb") as f:
75
  logo_data = base64.b64encode(f.read()).decode('utf-8')
76
- # Add #openhands-logo fragment to enable CSS targeting for dark mode handling
77
  return dict(
78
- source=f"data:image/png;base64,{logo_data}#openhands-logo",
79
  xref="paper",
80
  yref="paper",
81
  x=0,
@@ -348,11 +348,10 @@ def create_accuracy_by_size_chart(df: pd.DataFrame) -> go.Figure:
348
 
349
  Args:
350
  df: DataFrame with columns including 'parameter_count_b' or 'Parameter_Count_B',
351
- 'active_parameter_count_b' or 'Active_Parameter_Count_B',
352
  'average score', 'openness', 'Language Model'
353
 
354
  Returns:
355
- Plotly figure showing accuracy vs model size
356
  """
357
  import numpy as np
358
 
@@ -363,12 +362,6 @@ def create_accuracy_by_size_chart(df: pd.DataFrame) -> go.Figure:
363
  param_col = col
364
  break
365
 
366
- active_param_col = None
367
- for col in ['active_parameter_count_b', 'Active_Parameter_Count_B', 'Active Parameter Count B']:
368
- if col in df.columns:
369
- active_param_col = col
370
- break
371
-
372
  if df.empty or param_col is None:
373
  fig = go.Figure()
374
  fig.add_annotation(
@@ -440,19 +433,16 @@ def create_accuracy_by_size_chart(df: pd.DataFrame) -> go.Figure:
440
  data_points = []
441
  for _, row in plot_df.iterrows():
442
  total_params = row[param_col]
443
- active_params = row.get(active_param_col) if active_param_col else None
444
  model_name = row.get(model_col, 'Unknown')
445
  score = row[score_col]
446
 
447
- # Use active params for x-axis if available (more meaningful for MoE)
448
- x_val = active_params if pd.notna(active_params) else total_params
449
 
450
  # Create hover text matching existing chart style
451
  h_pad = " "
452
  hover_text = f"<br>{h_pad}<b>{model_name}</b>{h_pad}<br>"
453
- hover_text += f"{h_pad}Total Params: <b>{total_params:.0f}B</b>{h_pad}<br>"
454
- if pd.notna(active_params):
455
- hover_text += f"{h_pad}Active Params: <b>{active_params:.0f}B</b>{h_pad}<br>"
456
  hover_text += f"{h_pad}Average Score: <b>{score:.1f}</b>{h_pad}<br>"
457
 
458
  data_points.append({
@@ -601,7 +591,7 @@ def create_accuracy_by_size_chart(df: pd.DataFrame) -> go.Figure:
601
  **STANDARD_LAYOUT,
602
  title="Open Model Accuracy by Size",
603
  xaxis=dict(
604
- title="Active Parameters (Billions)",
605
  type="log",
606
  range=[x_min_log, x_max_log]
607
  ),
 
66
  def get_openhands_logo_image():
67
  """Get the OpenHands logo as a Plotly image dict for chart branding.
68
 
69
+ Uses a special MIME type parameter (;openhands=logo) to allow CSS targeting.
70
+ This enables CSS attribute selectors to identify this specific image.
71
  """
72
  if os.path.exists(OPENHANDS_LOGO_PATH_LIGHT):
73
  try:
74
  with open(OPENHANDS_LOGO_PATH_LIGHT, "rb") as f:
75
  logo_data = base64.b64encode(f.read()).decode('utf-8')
76
+ # Add openhands=logo parameter to MIME type for CSS targeting
77
  return dict(
78
+ source=f"data:image/png;openhands=logo;base64,{logo_data}",
79
  xref="paper",
80
  yref="paper",
81
  x=0,
 
348
 
349
  Args:
350
  df: DataFrame with columns including 'parameter_count_b' or 'Parameter_Count_B',
 
351
  'average score', 'openness', 'Language Model'
352
 
353
  Returns:
354
+ Plotly figure showing accuracy vs model size (total parameters)
355
  """
356
  import numpy as np
357
 
 
362
  param_col = col
363
  break
364
 
 
 
 
 
 
 
365
  if df.empty or param_col is None:
366
  fig = go.Figure()
367
  fig.add_annotation(
 
433
  data_points = []
434
  for _, row in plot_df.iterrows():
435
  total_params = row[param_col]
 
436
  model_name = row.get(model_col, 'Unknown')
437
  score = row[score_col]
438
 
439
+ # Use total params for x-axis
440
+ x_val = total_params
441
 
442
  # Create hover text matching existing chart style
443
  h_pad = " "
444
  hover_text = f"<br>{h_pad}<b>{model_name}</b>{h_pad}<br>"
445
+ hover_text += f"{h_pad}Parameters: <b>{total_params:.0f}B</b>{h_pad}<br>"
 
 
446
  hover_text += f"{h_pad}Average Score: <b>{score:.1f}</b>{h_pad}<br>"
447
 
448
  data_points.append({
 
591
  **STANDARD_LAYOUT,
592
  title="Open Model Accuracy by Size",
593
  xaxis=dict(
594
+ title="Parameters (Billions)",
595
  type="log",
596
  range=[x_min_log, x_max_log]
597
  ),