Spaces:
Running
Running
add guide to submit
Browse files- src/app.py +56 -49
- src/components/header.py +62 -0
- src/core/styles.py +55 -1
- src/static/images/Bench.gif +3 -0
- src/static/images/Download_on_the_App_Store_Badge.svg +46 -0
- src/static/images/GetItOnGooglePlay_Badge.png +0 -0
src/app.py
CHANGED
@@ -8,7 +8,7 @@ from .components.visualizations import (
|
|
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 |
|
@@ -87,56 +87,63 @@ async def main():
|
|
87 |
max_n_gpu_layers,
|
88 |
) = get_filter_values(df)
|
89 |
|
90 |
-
#
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
# Render plot section
|
108 |
-
st.markdown("---")
|
109 |
-
st.title("📊 Performance Comparison")
|
110 |
-
|
111 |
-
# Plot specific selectors in a row
|
112 |
-
plot_col1, plot_col2, plot_col3 = st.columns(3)
|
113 |
-
|
114 |
-
with plot_col1:
|
115 |
-
plot_model = st.selectbox(
|
116 |
-
"Select Model for Comparison", options=models, key="plot_model_selector"
|
117 |
)
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
)
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
|
142 |
if __name__ == "__main__":
|
|
|
8 |
render_leaderboard_table,
|
9 |
render_performance_plots,
|
10 |
)
|
11 |
+
from .components.header import render_header, render_contribution_guide
|
12 |
from .services.firebase import fetch_leaderboard_data
|
13 |
from .core.styles import CUSTOM_CSS
|
14 |
|
|
|
87 |
max_n_gpu_layers,
|
88 |
) = get_filter_values(df)
|
89 |
|
90 |
+
# Create main layout with sidebar for contribution guide
|
91 |
+
main_col, guide_col = st.columns([0.8, 0.2])
|
92 |
+
|
93 |
+
with main_col:
|
94 |
+
# Render filters
|
95 |
+
table_filters = render_table_filters(
|
96 |
+
models,
|
97 |
+
platforms,
|
98 |
+
devices,
|
99 |
+
cache_type_v,
|
100 |
+
cache_type_k,
|
101 |
+
pp_range,
|
102 |
+
tg_range,
|
103 |
+
n_threads,
|
104 |
+
versions,
|
105 |
+
max_n_gpu_layers,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
)
|
107 |
|
108 |
+
# Render the main leaderboard table
|
109 |
+
render_leaderboard_table(df, table_filters)
|
110 |
+
|
111 |
+
# Render plot section
|
112 |
+
st.markdown("---")
|
113 |
+
st.title("📊 Performance Comparison")
|
114 |
+
|
115 |
+
# Plot specific selectors in a row
|
116 |
+
plot_col1, plot_col2, plot_col3 = st.columns(3)
|
117 |
+
|
118 |
+
with plot_col1:
|
119 |
+
plot_model = st.selectbox(
|
120 |
+
"Select Model for Comparison", options=models, key="plot_model_selector"
|
121 |
+
)
|
122 |
+
|
123 |
+
with plot_col2:
|
124 |
+
plot_pp = st.selectbox(
|
125 |
+
"Select PP Config for Comparison",
|
126 |
+
options=sorted([int(x) for x in df["PP Config"].unique()]),
|
127 |
+
key="plot_pp_selector",
|
128 |
+
)
|
129 |
+
|
130 |
+
with plot_col3:
|
131 |
+
plot_tg = st.selectbox(
|
132 |
+
"Select TG Config for Comparison",
|
133 |
+
options=sorted([int(x) for x in df["TG Config"].unique()]),
|
134 |
+
key="plot_tg_selector",
|
135 |
+
)
|
136 |
+
|
137 |
+
# Create plot filters based on table filters but override the model and configs
|
138 |
+
plot_filters = table_filters.copy()
|
139 |
+
plot_filters["model"] = plot_model
|
140 |
+
plot_filters["pp_range"] = (plot_pp, plot_pp) # Set exact PP value
|
141 |
+
plot_filters["tg_range"] = (plot_tg, plot_tg) # Set exact TG value
|
142 |
+
|
143 |
+
render_performance_plots(df, plot_filters)
|
144 |
+
|
145 |
+
with guide_col:
|
146 |
+
render_contribution_guide()
|
147 |
|
148 |
|
149 |
if __name__ == "__main__":
|
src/components/header.py
CHANGED
@@ -13,6 +13,68 @@ def get_image_base64(image_path: Path) -> str:
|
|
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
|
|
|
13 |
return base64.b64encode(img_file.read()).decode("utf-8")
|
14 |
|
15 |
|
16 |
+
def render_contribution_guide():
|
17 |
+
"""Render the contribution guide section"""
|
18 |
+
st.markdown("### 🚀 Contribute")
|
19 |
+
st.markdown(
|
20 |
+
"""
|
21 |
+
How does your device stack up? Benchmark your phone and join the leaderboard!
|
22 |
+
"""
|
23 |
+
)
|
24 |
+
|
25 |
+
# Store badges in a row container
|
26 |
+
st.markdown('<div class="store-badges-row">', unsafe_allow_html=True)
|
27 |
+
|
28 |
+
col1, col2 = st.columns(2)
|
29 |
+
with col1:
|
30 |
+
# Google Play badge
|
31 |
+
playstore_badge = Path("src/static/images/GetItOnGooglePlay_Badge.png")
|
32 |
+
if playstore_badge.exists():
|
33 |
+
st.markdown(
|
34 |
+
f'<a href="https://play.google.com/store/apps/details?id=com.pocketpalai" target="_blank">'
|
35 |
+
f'<img src="data:image/png;base64,{get_image_base64(playstore_badge)}" '
|
36 |
+
'class="store-badge" alt="Get it on Google Play">'
|
37 |
+
"</a>",
|
38 |
+
unsafe_allow_html=True,
|
39 |
+
)
|
40 |
+
|
41 |
+
with col2:
|
42 |
+
# App Store badge
|
43 |
+
appstore_badge = Path("src/static/images/Download_on_the_App_Store_Badge.svg")
|
44 |
+
if appstore_badge.exists():
|
45 |
+
st.markdown(
|
46 |
+
f'<a href="https://apps.apple.com/de/app/pocketpal-ai/id6502579498" target="_blank">'
|
47 |
+
f'<img src="data:image/svg+xml;base64,{get_image_base64(appstore_badge)}" '
|
48 |
+
'class="store-badge" alt="Download on the App Store">'
|
49 |
+
"</a>",
|
50 |
+
unsafe_allow_html=True,
|
51 |
+
)
|
52 |
+
|
53 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
54 |
+
|
55 |
+
# Steps to contribute
|
56 |
+
st.markdown(
|
57 |
+
"""
|
58 |
+
#### Quick Guide:
|
59 |
+
1. **Download** PocketPal AI
|
60 |
+
2. **Get** your preferred model
|
61 |
+
3. **Run** benchmark
|
62 |
+
4. **Submit** to leaderboard
|
63 |
+
"""
|
64 |
+
)
|
65 |
+
|
66 |
+
# Demo video/gif
|
67 |
+
demo_gif = Path("src/static/images/Bench.gif")
|
68 |
+
if demo_gif.exists():
|
69 |
+
st.markdown(
|
70 |
+
f'<div class="demo-container">'
|
71 |
+
f'<img src="data:image/gif;base64,{get_image_base64(demo_gif)}" '
|
72 |
+
'class="demo-gif" alt="Benchmark Demo">'
|
73 |
+
"</div>",
|
74 |
+
unsafe_allow_html=True,
|
75 |
+
)
|
76 |
+
|
77 |
+
|
78 |
def render_header():
|
79 |
"""Render the application header with logos"""
|
80 |
# Logo paths
|
src/core/styles.py
CHANGED
@@ -58,5 +58,59 @@ CUSTOM_CSS = """
|
|
58 |
padding-bottom: 1rem;
|
59 |
max-width: 800px;
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
</style>
|
62 |
-
"""
|
|
|
58 |
padding-bottom: 1rem;
|
59 |
max-width: 800px;
|
60 |
}
|
61 |
+
/* Contribution Guide Styles */
|
62 |
+
.store-badges-row {
|
63 |
+
display: flex;
|
64 |
+
justify-content: center;
|
65 |
+
gap: 10px;
|
66 |
+
margin: 10px 0;
|
67 |
+
flex-wrap: wrap;
|
68 |
+
}
|
69 |
+
.store-badge {
|
70 |
+
height: 35px;
|
71 |
+
transition: transform 0.2s;
|
72 |
+
display: inline-block;
|
73 |
+
}
|
74 |
+
.store-badge:hover {
|
75 |
+
transform: scale(1.05);
|
76 |
+
}
|
77 |
+
.demo-container {
|
78 |
+
background: #f8f9fa;
|
79 |
+
padding: 10px;
|
80 |
+
border-radius: 8px;
|
81 |
+
margin: 15px 0;
|
82 |
+
text-align: center;
|
83 |
+
}
|
84 |
+
.demo-gif {
|
85 |
+
width: 100%;
|
86 |
+
max-width: 250px;
|
87 |
+
border-radius: 8px;
|
88 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
89 |
+
}
|
90 |
+
/* Guide Typography */
|
91 |
+
div[data-testid="column"]:last-child h3 {
|
92 |
+
font-size: 1.3rem;
|
93 |
+
margin: 0.5rem 0;
|
94 |
+
color: #1a1a1a;
|
95 |
+
}
|
96 |
+
div[data-testid="column"]:last-child h4 {
|
97 |
+
font-size: 1.1rem;
|
98 |
+
margin: 1rem 0 0.5rem 0;
|
99 |
+
color: #333;
|
100 |
+
}
|
101 |
+
div[data-testid="column"]:last-child ol {
|
102 |
+
padding-left: 1.2rem;
|
103 |
+
margin: 0.5rem 0;
|
104 |
+
}
|
105 |
+
div[data-testid="column"]:last-child li {
|
106 |
+
margin: 0.3rem 0;
|
107 |
+
color: #444;
|
108 |
+
font-size: 0.9rem;
|
109 |
+
}
|
110 |
+
div[data-testid="column"]:last-child p {
|
111 |
+
font-size: 0.95rem;
|
112 |
+
color: #666;
|
113 |
+
margin: 0.5rem 0;
|
114 |
+
}
|
115 |
</style>
|
116 |
+
"""
|
src/static/images/Bench.gif
ADDED
![]() |
Git LFS Details
|
src/static/images/Download_on_the_App_Store_Badge.svg
ADDED
|
src/static/images/GetItOnGooglePlay_Badge.png
ADDED
![]() |