Spaces:
Running
Running
openhands openhands commited on
Commit ·
32ccf4d
1
Parent(s): 0cdbc85
Add OpenHands logo and URL branding to charts
Browse files- Add OpenHands logo at bottom left of all charts
- Add https://index.openhands.dev URL at bottom right
- Add logo assets for light/dark backgrounds
- Include branding in both leaderboard_transformer and visualizations charts
Co-authored-by: openhands <openhands@all-hands.dev>
assets/openhands_logo_color_forblack.png
ADDED
|
assets/openhands_logo_color_forwhite.png
ADDED
|
leaderboard_transformer.py
CHANGED
|
@@ -39,6 +39,66 @@ COMPANY_LOGO_MAP = {
|
|
| 39 |
"minimax": {"path": "assets/logo-minimax.svg", "name": "MiniMax"},
|
| 40 |
}
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
def get_company_from_model_name(model_name: str) -> dict:
|
| 44 |
"""
|
|
@@ -737,6 +797,8 @@ def _plot_scatter_plotly(
|
|
| 737 |
font_family="Outfit",
|
| 738 |
font_color="#F7F8FB", # neutral-50
|
| 739 |
),
|
|
|
|
|
|
|
| 740 |
)
|
| 741 |
|
| 742 |
# Add company logo images to the layout if any were collected
|
|
@@ -744,6 +806,9 @@ def _plot_scatter_plotly(
|
|
| 744 |
layout_config['images'] = layout_images
|
| 745 |
|
| 746 |
fig.update_layout(**layout_config)
|
|
|
|
|
|
|
|
|
|
| 747 |
|
| 748 |
return fig
|
| 749 |
|
|
|
|
| 39 |
"minimax": {"path": "assets/logo-minimax.svg", "name": "MiniMax"},
|
| 40 |
}
|
| 41 |
|
| 42 |
+
# OpenHands branding constants
|
| 43 |
+
OPENHANDS_LOGO_PATH = "assets/openhands_logo_color_forwhite.png"
|
| 44 |
+
OPENHANDS_URL = "https://index.openhands.dev"
|
| 45 |
+
|
| 46 |
+
# URL annotation for bottom right of charts
|
| 47 |
+
URL_ANNOTATION = dict(
|
| 48 |
+
text=OPENHANDS_URL,
|
| 49 |
+
xref="paper",
|
| 50 |
+
yref="paper",
|
| 51 |
+
x=1,
|
| 52 |
+
y=-0.12,
|
| 53 |
+
xanchor="right",
|
| 54 |
+
yanchor="bottom",
|
| 55 |
+
showarrow=False,
|
| 56 |
+
font=dict(
|
| 57 |
+
family="Outfit, ui-sans-serif, sans-serif",
|
| 58 |
+
size=11,
|
| 59 |
+
color="#82889B", # neutral-400
|
| 60 |
+
),
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def get_openhands_logo_image():
|
| 65 |
+
"""Get the OpenHands logo as a Plotly image dict for chart branding."""
|
| 66 |
+
if os.path.exists(OPENHANDS_LOGO_PATH):
|
| 67 |
+
try:
|
| 68 |
+
with open(OPENHANDS_LOGO_PATH, "rb") as f:
|
| 69 |
+
logo_data = base64.b64encode(f.read()).decode('utf-8')
|
| 70 |
+
return dict(
|
| 71 |
+
source=f"data:image/png;base64,{logo_data}",
|
| 72 |
+
xref="paper",
|
| 73 |
+
yref="paper",
|
| 74 |
+
x=0,
|
| 75 |
+
y=-0.12,
|
| 76 |
+
sizex=0.15,
|
| 77 |
+
sizey=0.15,
|
| 78 |
+
xanchor="left",
|
| 79 |
+
yanchor="bottom",
|
| 80 |
+
)
|
| 81 |
+
except Exception:
|
| 82 |
+
pass
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def add_branding_to_figure(fig: go.Figure) -> go.Figure:
|
| 87 |
+
"""Add OpenHands logo and URL to a Plotly figure."""
|
| 88 |
+
# Add logo image
|
| 89 |
+
logo_image = get_openhands_logo_image()
|
| 90 |
+
if logo_image:
|
| 91 |
+
existing_images = list(fig.layout.images) if fig.layout.images else []
|
| 92 |
+
existing_images.append(logo_image)
|
| 93 |
+
fig.update_layout(images=existing_images)
|
| 94 |
+
|
| 95 |
+
# Add URL annotation
|
| 96 |
+
existing_annotations = list(fig.layout.annotations) if fig.layout.annotations else []
|
| 97 |
+
existing_annotations.append(URL_ANNOTATION)
|
| 98 |
+
fig.update_layout(annotations=existing_annotations)
|
| 99 |
+
|
| 100 |
+
return fig
|
| 101 |
+
|
| 102 |
|
| 103 |
def get_company_from_model_name(model_name: str) -> dict:
|
| 104 |
"""
|
|
|
|
| 797 |
font_family="Outfit",
|
| 798 |
font_color="#F7F8FB", # neutral-50
|
| 799 |
),
|
| 800 |
+
# Add margin at bottom for logo and URL
|
| 801 |
+
margin=dict(b=80),
|
| 802 |
)
|
| 803 |
|
| 804 |
# Add company logo images to the layout if any were collected
|
|
|
|
| 806 |
layout_config['images'] = layout_images
|
| 807 |
|
| 808 |
fig.update_layout(**layout_config)
|
| 809 |
+
|
| 810 |
+
# Add OpenHands branding (logo and URL)
|
| 811 |
+
add_branding_to_figure(fig)
|
| 812 |
|
| 813 |
return fig
|
| 814 |
|
visualizations.py
CHANGED
|
@@ -30,6 +30,7 @@ STANDARD_LAYOUT = dict(
|
|
| 30 |
legend=dict(
|
| 31 |
bgcolor='#F7F8FB', # neutral-50
|
| 32 |
),
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
# Standard font for annotations
|
|
@@ -39,6 +40,66 @@ STANDARD_FONT = dict(
|
|
| 39 |
family='Outfit'
|
| 40 |
)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
|
| 44 |
"""
|
|
@@ -264,6 +325,9 @@ def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
|
|
| 264 |
|
| 265 |
fig.update_layout(**layout_config)
|
| 266 |
|
|
|
|
|
|
|
|
|
|
| 267 |
return fig
|
| 268 |
|
| 269 |
|
|
@@ -519,4 +583,7 @@ def create_accuracy_by_size_chart(df: pd.DataFrame) -> go.Figure:
|
|
| 519 |
align='left'
|
| 520 |
)
|
| 521 |
|
|
|
|
|
|
|
|
|
|
| 522 |
return fig
|
|
|
|
| 30 |
legend=dict(
|
| 31 |
bgcolor='#F7F8FB', # neutral-50
|
| 32 |
),
|
| 33 |
+
margin=dict(b=80), # Extra margin for logo and URL
|
| 34 |
)
|
| 35 |
|
| 36 |
# Standard font for annotations
|
|
|
|
| 40 |
family='Outfit'
|
| 41 |
)
|
| 42 |
|
| 43 |
+
# OpenHands branding constants
|
| 44 |
+
OPENHANDS_LOGO_PATH = "assets/openhands_logo_color_forwhite.png"
|
| 45 |
+
OPENHANDS_URL = "https://index.openhands.dev"
|
| 46 |
+
|
| 47 |
+
# URL annotation for bottom right of charts
|
| 48 |
+
URL_ANNOTATION = dict(
|
| 49 |
+
text=OPENHANDS_URL,
|
| 50 |
+
xref="paper",
|
| 51 |
+
yref="paper",
|
| 52 |
+
x=1,
|
| 53 |
+
y=-0.12,
|
| 54 |
+
xanchor="right",
|
| 55 |
+
yanchor="bottom",
|
| 56 |
+
showarrow=False,
|
| 57 |
+
font=dict(
|
| 58 |
+
family="Outfit, ui-sans-serif, sans-serif",
|
| 59 |
+
size=11,
|
| 60 |
+
color="#82889B", # neutral-400
|
| 61 |
+
),
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def get_openhands_logo_image():
|
| 66 |
+
"""Get the OpenHands logo as a Plotly image dict for chart branding."""
|
| 67 |
+
if os.path.exists(OPENHANDS_LOGO_PATH):
|
| 68 |
+
try:
|
| 69 |
+
with open(OPENHANDS_LOGO_PATH, "rb") as f:
|
| 70 |
+
logo_data = base64.b64encode(f.read()).decode('utf-8')
|
| 71 |
+
return dict(
|
| 72 |
+
source=f"data:image/png;base64,{logo_data}",
|
| 73 |
+
xref="paper",
|
| 74 |
+
yref="paper",
|
| 75 |
+
x=0,
|
| 76 |
+
y=-0.12,
|
| 77 |
+
sizex=0.15,
|
| 78 |
+
sizey=0.15,
|
| 79 |
+
xanchor="left",
|
| 80 |
+
yanchor="bottom",
|
| 81 |
+
)
|
| 82 |
+
except Exception:
|
| 83 |
+
pass
|
| 84 |
+
return None
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def add_branding_to_figure(fig: go.Figure) -> go.Figure:
|
| 88 |
+
"""Add OpenHands logo and URL to a Plotly figure."""
|
| 89 |
+
# Add logo image
|
| 90 |
+
logo_image = get_openhands_logo_image()
|
| 91 |
+
if logo_image:
|
| 92 |
+
existing_images = list(fig.layout.images) if fig.layout.images else []
|
| 93 |
+
existing_images.append(logo_image)
|
| 94 |
+
fig.update_layout(images=existing_images)
|
| 95 |
+
|
| 96 |
+
# Add URL annotation
|
| 97 |
+
existing_annotations = list(fig.layout.annotations) if fig.layout.annotations else []
|
| 98 |
+
existing_annotations.append(URL_ANNOTATION)
|
| 99 |
+
fig.update_layout(annotations=existing_annotations)
|
| 100 |
+
|
| 101 |
+
return fig
|
| 102 |
+
|
| 103 |
|
| 104 |
def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
|
| 105 |
"""
|
|
|
|
| 325 |
|
| 326 |
fig.update_layout(**layout_config)
|
| 327 |
|
| 328 |
+
# Add OpenHands branding
|
| 329 |
+
add_branding_to_figure(fig)
|
| 330 |
+
|
| 331 |
return fig
|
| 332 |
|
| 333 |
|
|
|
|
| 583 |
align='left'
|
| 584 |
)
|
| 585 |
|
| 586 |
+
# Add OpenHands branding
|
| 587 |
+
add_branding_to_figure(fig)
|
| 588 |
+
|
| 589 |
return fig
|