Spaces:
Running
Running
update
Browse files
client/src/components/LeaderboardSection.jsx
CHANGED
@@ -1,5 +1,15 @@
|
|
1 |
import React, { useState, useMemo } from "react";
|
2 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import { alpha } from "@mui/material/styles";
|
4 |
import LeaderboardCard from "./LeaderboardCard";
|
5 |
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
@@ -168,86 +178,115 @@ const LeaderboardSection = ({
|
|
168 |
</Box>
|
169 |
|
170 |
{languages && selectedCategory === "language" && (
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
180 |
sx={{
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
186 |
}}
|
187 |
>
|
188 |
-
{
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
backgroundColor: (theme) =>
|
202 |
-
isActive
|
203 |
-
? undefined
|
204 |
-
: theme.palette.mode === "dark"
|
205 |
-
? "background.paper"
|
206 |
-
: "white",
|
207 |
-
"&:hover": {
|
208 |
backgroundColor: (theme) =>
|
209 |
isActive
|
210 |
? undefined
|
211 |
: theme.palette.mode === "dark"
|
212 |
? "background.paper"
|
213 |
: "white",
|
214 |
-
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
transition: "none",
|
217 |
-
},
|
218 |
-
transition: "none",
|
219 |
-
}}
|
220 |
-
>
|
221 |
-
{lang}
|
222 |
-
<Box
|
223 |
-
component="span"
|
224 |
-
sx={{
|
225 |
-
display: "inline-flex",
|
226 |
-
alignItems: "center",
|
227 |
-
gap: 0.75,
|
228 |
-
color: isActive ? "inherit" : "text.secondary",
|
229 |
-
ml: 0.75,
|
230 |
}}
|
231 |
>
|
|
|
232 |
<Box
|
233 |
component="span"
|
234 |
-
sx={
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
)}
|
252 |
|
253 |
{filteredLeaderboards.length === 0 ? (
|
|
|
1 |
import React, { useState, useMemo } from "react";
|
2 |
+
import {
|
3 |
+
Typography,
|
4 |
+
Grid,
|
5 |
+
Box,
|
6 |
+
Button,
|
7 |
+
Collapse,
|
8 |
+
Stack,
|
9 |
+
Accordion,
|
10 |
+
AccordionSummary,
|
11 |
+
AccordionDetails,
|
12 |
+
} from "@mui/material";
|
13 |
import { alpha } from "@mui/material/styles";
|
14 |
import LeaderboardCard from "./LeaderboardCard";
|
15 |
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
|
178 |
</Box>
|
179 |
|
180 |
{languages && selectedCategory === "language" && (
|
181 |
+
<Accordion
|
182 |
+
defaultExpanded={false}
|
183 |
+
elevation={0}
|
184 |
+
sx={{
|
185 |
+
mb: filteredLeaderboards.length > 0 ? 4 : 2,
|
186 |
+
"&:before": {
|
187 |
+
display: "none",
|
188 |
+
},
|
189 |
+
backgroundColor: "transparent",
|
190 |
+
}}
|
191 |
+
>
|
192 |
+
<AccordionSummary
|
193 |
+
expandIcon={<ExpandMoreIcon sx={{ fontSize: 20 }} />}
|
194 |
sx={{
|
195 |
+
padding: 0,
|
196 |
+
"& .MuiAccordionSummary-content": {
|
197 |
+
margin: 0,
|
198 |
+
},
|
199 |
+
"& .MuiAccordionSummary-expandIconWrapper": {
|
200 |
+
position: "relative",
|
201 |
+
right: "unset",
|
202 |
+
marginLeft: 1,
|
203 |
+
transform: "none",
|
204 |
+
},
|
205 |
}}
|
206 |
>
|
207 |
+
<Box sx={{ display: "flex", alignItems: "center" }}>
|
208 |
+
<Typography
|
209 |
+
variant="body2"
|
210 |
+
color="text.secondary"
|
211 |
+
sx={{ fontWeight: 500 }}
|
212 |
+
>
|
213 |
+
Languages represented in this category
|
214 |
+
</Typography>
|
215 |
+
</Box>
|
216 |
+
</AccordionSummary>
|
217 |
+
<AccordionDetails sx={{ padding: 0 }}>
|
218 |
+
<Box
|
219 |
+
sx={{
|
220 |
+
display: "flex",
|
221 |
+
flexWrap: "wrap",
|
222 |
+
gap: 1,
|
223 |
+
mx: -0.5,
|
224 |
+
}}
|
225 |
+
>
|
226 |
+
{languages.map((lang) => {
|
227 |
+
const isActive = selectedLanguage === lang;
|
228 |
+
const count = languageStats?.get(lang) || 0;
|
229 |
|
230 |
+
return (
|
231 |
+
<Button
|
232 |
+
key={lang}
|
233 |
+
onClick={() => setSelectedLanguage(isActive ? null : lang)}
|
234 |
+
variant={isActive ? "contained" : "outlined"}
|
235 |
+
size="small"
|
236 |
+
sx={{
|
237 |
+
textTransform: "none",
|
238 |
+
m: 0.125,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
backgroundColor: (theme) =>
|
240 |
isActive
|
241 |
? undefined
|
242 |
: theme.palette.mode === "dark"
|
243 |
? "background.paper"
|
244 |
: "white",
|
245 |
+
"&:hover": {
|
246 |
+
backgroundColor: (theme) =>
|
247 |
+
isActive
|
248 |
+
? undefined
|
249 |
+
: theme.palette.mode === "dark"
|
250 |
+
? "background.paper"
|
251 |
+
: "white",
|
252 |
+
},
|
253 |
+
"& .MuiTouchRipple-root": {
|
254 |
+
transition: "none",
|
255 |
+
},
|
256 |
transition: "none",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}}
|
258 |
>
|
259 |
+
{lang}
|
260 |
<Box
|
261 |
component="span"
|
262 |
+
sx={{
|
263 |
+
display: "inline-flex",
|
264 |
+
alignItems: "center",
|
265 |
+
gap: 0.75,
|
266 |
+
color: isActive ? "inherit" : "text.secondary",
|
267 |
+
ml: 0.75,
|
268 |
+
}}
|
269 |
+
>
|
270 |
+
<Box
|
271 |
+
component="span"
|
272 |
+
sx={(theme) => ({
|
273 |
+
width: "4px",
|
274 |
+
height: "4px",
|
275 |
+
borderRadius: "100%",
|
276 |
+
backgroundColor: alpha(
|
277 |
+
theme.palette.text.primary,
|
278 |
+
theme.palette.mode === "dark" ? 0.2 : 0.15
|
279 |
+
),
|
280 |
+
})}
|
281 |
+
/>
|
282 |
+
{count}
|
283 |
+
</Box>
|
284 |
+
</Button>
|
285 |
+
);
|
286 |
+
})}
|
287 |
+
</Box>
|
288 |
+
</AccordionDetails>
|
289 |
+
</Accordion>
|
290 |
)}
|
291 |
|
292 |
{filteredLeaderboards.length === 0 ? (
|
client/src/components/Navigation/Navigation.jsx
CHANGED
@@ -123,8 +123,8 @@ const Navigation = ({ onToggleTheme, mode }) => {
|
|
123 |
How to submit
|
124 |
</Box>
|
125 |
</Link>
|
126 |
-
|
127 |
-
|
128 |
href="https://huggingface.co/docs/leaderboards/open_llm_leaderboard/about"
|
129 |
target="_blank"
|
130 |
rel="noopener noreferrer"
|
@@ -143,7 +143,7 @@ const Navigation = ({ onToggleTheme, mode }) => {
|
|
143 |
>
|
144 |
About
|
145 |
<OpenInNewIcon />
|
146 |
-
</MuiLink>
|
147 |
</Box>
|
148 |
<Separator />
|
149 |
<Tooltip
|
|
|
123 |
How to submit
|
124 |
</Box>
|
125 |
</Link>
|
126 |
+
{/*<Separator />
|
127 |
+
<MuiLink
|
128 |
href="https://huggingface.co/docs/leaderboards/open_llm_leaderboard/about"
|
129 |
target="_blank"
|
130 |
rel="noopener noreferrer"
|
|
|
143 |
>
|
144 |
About
|
145 |
<OpenInNewIcon />
|
146 |
+
</MuiLink> */}
|
147 |
</Box>
|
148 |
<Separator />
|
149 |
<Tooltip
|
server/server.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from fastapi import FastAPI, HTTPException, Request
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
from fastapi.staticfiles import StaticFiles
|
|
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
from datetime import datetime
|
6 |
import os
|
@@ -88,9 +89,6 @@ def fetch_leaderboards():
|
|
88 |
# Initial fetch
|
89 |
fetch_leaderboards()
|
90 |
|
91 |
-
# Mount static files
|
92 |
-
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
93 |
-
|
94 |
@app.get("/api/leaderboards")
|
95 |
async def get_leaderboards():
|
96 |
"""Get leaderboards data from cache"""
|
@@ -144,6 +142,9 @@ async def handle_webhook(request: Request):
|
|
144 |
logging.error(f"Error processing webhook: {str(e)}", exc_info=True)
|
145 |
raise HTTPException(status_code=500, detail=f"Failed to process webhook: {str(e)}")
|
146 |
|
|
|
|
|
|
|
147 |
if __name__ == "__main__":
|
148 |
import uvicorn
|
149 |
uvicorn.run("server:app", host=API_HOST, port=API_PORT, reload=True)
|
|
|
1 |
from fastapi import FastAPI, HTTPException, Request
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
from fastapi.staticfiles import StaticFiles
|
4 |
+
from fastapi.responses import FileResponse
|
5 |
from apscheduler.schedulers.background import BackgroundScheduler
|
6 |
from datetime import datetime
|
7 |
import os
|
|
|
89 |
# Initial fetch
|
90 |
fetch_leaderboards()
|
91 |
|
|
|
|
|
|
|
92 |
@app.get("/api/leaderboards")
|
93 |
async def get_leaderboards():
|
94 |
"""Get leaderboards data from cache"""
|
|
|
142 |
logging.error(f"Error processing webhook: {str(e)}", exc_info=True)
|
143 |
raise HTTPException(status_code=500, detail=f"Failed to process webhook: {str(e)}")
|
144 |
|
145 |
+
# Mount static files for the React client
|
146 |
+
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
147 |
+
|
148 |
if __name__ == "__main__":
|
149 |
import uvicorn
|
150 |
uvicorn.run("server:app", host=API_HOST, port=API_PORT, reload=True)
|