apply header
Browse files- src/app.py +8 -1
- src/components/header.py +5 -3
src/app.py
CHANGED
|
@@ -8,7 +8,9 @@ from .components.visualizations import (
|
|
| 8 |
render_leaderboard_table,
|
| 9 |
render_performance_plots,
|
| 10 |
)
|
|
|
|
| 11 |
from .services.firebase import fetch_leaderboard_data
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def get_unique_values(df: pd.DataFrame) -> tuple[List[str], List[str], List[str]]:
|
|
@@ -27,6 +29,9 @@ async def main():
|
|
| 27 |
layout="wide",
|
| 28 |
)
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
# Fetch initial data
|
| 31 |
df = await fetch_leaderboard_data()
|
| 32 |
|
|
@@ -34,6 +39,9 @@ async def main():
|
|
| 34 |
st.error("No data available. Please check your connection and try again.")
|
| 35 |
return
|
| 36 |
|
|
|
|
|
|
|
|
|
|
| 37 |
# Get unique values for filters
|
| 38 |
models, platforms, devices = get_unique_values(df)
|
| 39 |
|
|
@@ -41,7 +49,6 @@ async def main():
|
|
| 41 |
table_filters = render_table_filters(models, platforms, devices)
|
| 42 |
|
| 43 |
# Render the main leaderboard table
|
| 44 |
-
st.title("📱 AI Phone Benchmark Leaderboard")
|
| 45 |
render_leaderboard_table(df, table_filters)
|
| 46 |
|
| 47 |
# Render plot section
|
|
|
|
| 8 |
render_leaderboard_table,
|
| 9 |
render_performance_plots,
|
| 10 |
)
|
| 11 |
+
from .components.header import render_header
|
| 12 |
from .services.firebase import fetch_leaderboard_data
|
| 13 |
+
from .core.styles import CUSTOM_CSS
|
| 14 |
|
| 15 |
|
| 16 |
def get_unique_values(df: pd.DataFrame) -> tuple[List[str], List[str], List[str]]:
|
|
|
|
| 29 |
layout="wide",
|
| 30 |
)
|
| 31 |
|
| 32 |
+
# Apply custom styles
|
| 33 |
+
st.markdown(CUSTOM_CSS, unsafe_allow_html=True)
|
| 34 |
+
|
| 35 |
# Fetch initial data
|
| 36 |
df = await fetch_leaderboard_data()
|
| 37 |
|
|
|
|
| 39 |
st.error("No data available. Please check your connection and try again.")
|
| 40 |
return
|
| 41 |
|
| 42 |
+
# Render header
|
| 43 |
+
render_header()
|
| 44 |
+
|
| 45 |
# Get unique values for filters
|
| 46 |
models, platforms, devices = get_unique_values(df)
|
| 47 |
|
|
|
|
| 49 |
table_filters = render_table_filters(models, platforms, devices)
|
| 50 |
|
| 51 |
# Render the main leaderboard table
|
|
|
|
| 52 |
render_leaderboard_table(df, table_filters)
|
| 53 |
|
| 54 |
# Render plot section
|
src/components/header.py
CHANGED
|
@@ -2,6 +2,7 @@ import streamlit as st
|
|
| 2 |
import base64
|
| 3 |
from pathlib import Path
|
| 4 |
|
|
|
|
| 5 |
def get_image_base64(image_path: Path) -> str:
|
| 6 |
"""Convert image to base64 string"""
|
| 7 |
if not image_path.exists():
|
|
@@ -11,20 +12,21 @@ def get_image_base64(image_path: Path) -> str:
|
|
| 11 |
with open(image_path, "rb") as img_file:
|
| 12 |
return base64.b64encode(img_file.read()).decode("utf-8")
|
| 13 |
|
|
|
|
| 14 |
def render_header():
|
| 15 |
"""Render the application header with logos"""
|
| 16 |
# Logo paths
|
| 17 |
hf_logo_path = Path("src/static/images/hf-logo.png")
|
| 18 |
pocketpal_logo_path = Path("src/static/images/pocketpal-ai-logo.png")
|
| 19 |
-
|
| 20 |
header_html = f"""
|
| 21 |
<div class="header-container">
|
| 22 |
<div class="logos-container">
|
| 23 |
<img src="data:image/png;base64,{get_image_base64(hf_logo_path)}" class="logo" alt="Hugging Face Logo">
|
| 24 |
<img src="data:image/png;base64,{get_image_base64(pocketpal_logo_path)}" class="logo pocketpal" alt="PocketPal AI Logo">
|
| 25 |
</div>
|
| 26 |
-
<h1 class="header-title">AI Phone
|
| 27 |
<p class="header-subtitle">Comparing Large Language Models performance across AI Phones. Powered by PocketPal AI.</p>
|
| 28 |
</div>
|
| 29 |
"""
|
| 30 |
-
st.markdown(header_html, unsafe_allow_html=True)
|
|
|
|
| 2 |
import base64
|
| 3 |
from pathlib import Path
|
| 4 |
|
| 5 |
+
|
| 6 |
def get_image_base64(image_path: Path) -> str:
|
| 7 |
"""Convert image to base64 string"""
|
| 8 |
if not image_path.exists():
|
|
|
|
| 12 |
with open(image_path, "rb") as img_file:
|
| 13 |
return base64.b64encode(img_file.read()).decode("utf-8")
|
| 14 |
|
| 15 |
+
|
| 16 |
def render_header():
|
| 17 |
"""Render the application header with logos"""
|
| 18 |
# Logo paths
|
| 19 |
hf_logo_path = Path("src/static/images/hf-logo.png")
|
| 20 |
pocketpal_logo_path = Path("src/static/images/pocketpal-ai-logo.png")
|
| 21 |
+
|
| 22 |
header_html = f"""
|
| 23 |
<div class="header-container">
|
| 24 |
<div class="logos-container">
|
| 25 |
<img src="data:image/png;base64,{get_image_base64(hf_logo_path)}" class="logo" alt="Hugging Face Logo">
|
| 26 |
<img src="data:image/png;base64,{get_image_base64(pocketpal_logo_path)}" class="logo pocketpal" alt="PocketPal AI Logo">
|
| 27 |
</div>
|
| 28 |
+
<h1 class="header-title">AI Phone Leaderboard</h1>
|
| 29 |
<p class="header-subtitle">Comparing Large Language Models performance across AI Phones. Powered by PocketPal AI.</p>
|
| 30 |
</div>
|
| 31 |
"""
|
| 32 |
+
st.markdown(header_html, unsafe_allow_html=True)
|