Spaces:
Running
Running
update readme and cleanup
Browse files- README.md +1 -1
- client/src/context/LeaderboardContext.jsx +26 -0
- client/src/pages/LeaderboardPage/LeaderboardPage.jsx +75 -1
- server/pyproject.toml +1 -1
- server/server.py +5 -0
README.md
CHANGED
@@ -40,7 +40,7 @@ npm run dev
|
|
40 |
```bash
|
41 |
cd server
|
42 |
poetry install
|
43 |
-
poetry run
|
44 |
```
|
45 |
|
46 |
## Deployment
|
|
|
40 |
```bash
|
41 |
cd server
|
42 |
poetry install
|
43 |
+
poetry run dev
|
44 |
```
|
45 |
|
46 |
## Deployment
|
client/src/context/LeaderboardContext.jsx
CHANGED
@@ -60,6 +60,32 @@ export const LeaderboardProvider = ({ children }) => {
|
|
60 |
updateParams,
|
61 |
]);
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
// Wrapper pour setSelectedCategories qui gère aussi l'expansion des sections
|
64 |
const handleCategorySelection = useCallback((categoryId) => {
|
65 |
setSelectedCategories((prev) => {
|
|
|
60 |
updateParams,
|
61 |
]);
|
62 |
|
63 |
+
// Logger les leaderboards non catégorisés
|
64 |
+
useEffect(() => {
|
65 |
+
if (leaderboards.length > 0) {
|
66 |
+
const uncategorizedLeaderboards = leaderboards.filter(
|
67 |
+
(board) =>
|
68 |
+
board.approval_status === "approved" && isUncategorizedBoard(board)
|
69 |
+
);
|
70 |
+
|
71 |
+
if (uncategorizedLeaderboards.length > 0) {
|
72 |
+
console.log("=== LEADERBOARDS NON CATÉGORISÉS ===");
|
73 |
+
console.log(
|
74 |
+
`Total: ${uncategorizedLeaderboards.length} leaderboards non catégorisés`
|
75 |
+
);
|
76 |
+
console.table(
|
77 |
+
uncategorizedLeaderboards.map((board) => ({
|
78 |
+
id: board.id,
|
79 |
+
uid: board.uid,
|
80 |
+
title: board.card_data?.title || "Sans titre",
|
81 |
+
tags: (board.tags || []).join(", "),
|
82 |
+
url: board.card_data?.url || "",
|
83 |
+
}))
|
84 |
+
);
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}, [leaderboards]);
|
88 |
+
|
89 |
// Wrapper pour setSelectedCategories qui gère aussi l'expansion des sections
|
90 |
const handleCategorySelection = useCallback((categoryId) => {
|
91 |
setSelectedCategories((prev) => {
|
client/src/pages/LeaderboardPage/LeaderboardPage.jsx
CHANGED
@@ -1,6 +1,13 @@
|
|
1 |
import React, { useState, useEffect, useMemo } from "react";
|
2 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
|
4 |
import Logo from "../../components/Logo/Logo";
|
5 |
import PageTitle from "../../components/PageTitle/PageTitle";
|
6 |
import LeaderboardSection from "../../components/LeaderboardSection";
|
@@ -13,6 +20,7 @@ import {
|
|
13 |
|
14 |
const LeaderboardPageContent = () => {
|
15 |
const [loading, setLoading] = useState(true);
|
|
|
16 |
const {
|
17 |
setLeaderboards,
|
18 |
filterLeaderboards,
|
@@ -22,6 +30,7 @@ const LeaderboardPageContent = () => {
|
|
22 |
searchQuery,
|
23 |
arenaOnly,
|
24 |
selectedCategories,
|
|
|
25 |
} = useLeaderboard();
|
26 |
|
27 |
// Vérifier si on a uniquement une recherche textuelle active
|
@@ -40,6 +49,22 @@ const LeaderboardPageContent = () => {
|
|
40 |
);
|
41 |
}, [allSections]);
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
// Filtrer tous les leaderboards pour la recherche textuelle
|
44 |
const searchResults = useMemo(() => {
|
45 |
if (!isOnlyTextSearch) return [];
|
@@ -106,6 +131,33 @@ const LeaderboardPageContent = () => {
|
|
106 |
<span style={{ fontWeight: 600 }}>explore</span> all leaderboards from
|
107 |
the <span style={{ fontWeight: 600 }}>Hugging Face community</span>
|
108 |
</Typography>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
</Box>
|
110 |
|
111 |
{loading ? (
|
@@ -123,6 +175,28 @@ const LeaderboardPageContent = () => {
|
|
123 |
>
|
124 |
<LeaderboardFilters allSections={allSections} />
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
{/* Message global "No results" seulement si on n'a pas de résultats, pas de section de recherche, et pas de catégories sélectionnées */}
|
127 |
{!hasLeaderboards &&
|
128 |
isFiltering &&
|
|
|
1 |
import React, { useState, useEffect, useMemo } from "react";
|
2 |
+
import {
|
3 |
+
Box,
|
4 |
+
CircularProgress,
|
5 |
+
Typography,
|
6 |
+
Chip,
|
7 |
+
Tooltip,
|
8 |
+
} from "@mui/material";
|
9 |
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
10 |
+
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
|
11 |
import Logo from "../../components/Logo/Logo";
|
12 |
import PageTitle from "../../components/PageTitle/PageTitle";
|
13 |
import LeaderboardSection from "../../components/LeaderboardSection";
|
|
|
20 |
|
21 |
const LeaderboardPageContent = () => {
|
22 |
const [loading, setLoading] = useState(true);
|
23 |
+
const [showUncategorized, setShowUncategorized] = useState(false);
|
24 |
const {
|
25 |
setLeaderboards,
|
26 |
filterLeaderboards,
|
|
|
30 |
searchQuery,
|
31 |
arenaOnly,
|
32 |
selectedCategories,
|
33 |
+
leaderboards,
|
34 |
} = useLeaderboard();
|
35 |
|
36 |
// Vérifier si on a uniquement une recherche textuelle active
|
|
|
49 |
);
|
50 |
}, [allSections]);
|
51 |
|
52 |
+
// Calculer le nombre de leaderboards non catégorisés
|
53 |
+
const uncategorizedLeaderboards = useMemo(() => {
|
54 |
+
if (!leaderboards || leaderboards.length === 0) return [];
|
55 |
+
return leaderboards.filter(
|
56 |
+
(board) =>
|
57 |
+
board.approval_status === "approved" &&
|
58 |
+
!board.tags?.some(
|
59 |
+
(tag) =>
|
60 |
+
tag.startsWith("modality:") ||
|
61 |
+
tag.startsWith("eval:") ||
|
62 |
+
tag.startsWith("domain:") ||
|
63 |
+
tag.startsWith("language:")
|
64 |
+
)
|
65 |
+
);
|
66 |
+
}, [leaderboards]);
|
67 |
+
|
68 |
// Filtrer tous les leaderboards pour la recherche textuelle
|
69 |
const searchResults = useMemo(() => {
|
70 |
if (!isOnlyTextSearch) return [];
|
|
|
131 |
<span style={{ fontWeight: 600 }}>explore</span> all leaderboards from
|
132 |
the <span style={{ fontWeight: 600 }}>Hugging Face community</span>
|
133 |
</Typography>
|
134 |
+
|
135 |
+
{uncategorizedLeaderboards.length > 0 && (
|
136 |
+
<Tooltip
|
137 |
+
title={`${uncategorizedLeaderboards.length} leaderboards approuvés n'ont pas de catégorie et ne sont pas affichés dans les sections`}
|
138 |
+
>
|
139 |
+
<Chip
|
140 |
+
icon={<WarningAmberIcon />}
|
141 |
+
label={`${uncategorizedLeaderboards.length} leaderboards non catégorisés`}
|
142 |
+
color="warning"
|
143 |
+
variant="outlined"
|
144 |
+
sx={{ mt: 1 }}
|
145 |
+
onClick={() => {
|
146 |
+
console.log("=== LEADERBOARDS NON CATÉGORISÉS ===");
|
147 |
+
console.table(
|
148 |
+
uncategorizedLeaderboards.map((board) => ({
|
149 |
+
id: board.id,
|
150 |
+
uid: board.uid,
|
151 |
+
title: board.card_data?.title || "Sans titre",
|
152 |
+
tags: (board.tags || []).join(", "),
|
153 |
+
url: board.card_data?.url || "",
|
154 |
+
}))
|
155 |
+
);
|
156 |
+
setShowUncategorized(!showUncategorized);
|
157 |
+
}}
|
158 |
+
/>
|
159 |
+
</Tooltip>
|
160 |
+
)}
|
161 |
</Box>
|
162 |
|
163 |
{loading ? (
|
|
|
175 |
>
|
176 |
<LeaderboardFilters allSections={allSections} />
|
177 |
|
178 |
+
{/* Section pour les leaderboards non catégorisés */}
|
179 |
+
{showUncategorized && uncategorizedLeaderboards.length > 0 && (
|
180 |
+
<Box
|
181 |
+
sx={{
|
182 |
+
mb: 4,
|
183 |
+
p: 2,
|
184 |
+
border: "1px dashed",
|
185 |
+
borderColor: "warning.main",
|
186 |
+
borderRadius: 2,
|
187 |
+
bgcolor: (theme) => theme.palette.warning.light + "20",
|
188 |
+
}}
|
189 |
+
>
|
190 |
+
<LeaderboardSection
|
191 |
+
id="uncategorized"
|
192 |
+
title={`Leaderboards non catégorisés (${uncategorizedLeaderboards.length})`}
|
193 |
+
leaderboards={uncategorizedLeaderboards}
|
194 |
+
filteredLeaderboards={uncategorizedLeaderboards}
|
195 |
+
showEmptyState={false}
|
196 |
+
/>
|
197 |
+
</Box>
|
198 |
+
)}
|
199 |
+
|
200 |
{/* Message global "No results" seulement si on n'a pas de résultats, pas de section de recherche, et pas de catégories sélectionnées */}
|
201 |
{!hasLeaderboards &&
|
202 |
isFiltering &&
|
server/pyproject.toml
CHANGED
@@ -14,7 +14,7 @@ uvicorn = "^0.27.0"
|
|
14 |
python-dotenv = "^1.0.0"
|
15 |
|
16 |
[tool.poetry.scripts]
|
17 |
-
dev = "
|
18 |
|
19 |
[build-system]
|
20 |
requires = ["poetry-core>=1.0.0"]
|
|
|
14 |
python-dotenv = "^1.0.0"
|
15 |
|
16 |
[tool.poetry.scripts]
|
17 |
+
dev = "server:start"
|
18 |
|
19 |
[build-system]
|
20 |
requires = ["poetry-core>=1.0.0"]
|
server/server.py
CHANGED
@@ -15,6 +15,11 @@ app = FastAPI()
|
|
15 |
# Mount static files for the React client
|
16 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
if __name__ == "__main__":
|
19 |
import uvicorn
|
20 |
uvicorn.run("server:app", host=API_HOST, port=API_PORT, reload=True)
|
|
|
15 |
# Mount static files for the React client
|
16 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
17 |
|
18 |
+
def start():
|
19 |
+
"""Entry point for the Poetry script"""
|
20 |
+
import uvicorn
|
21 |
+
uvicorn.run("server:app", host=API_HOST, port=API_PORT, reload=True)
|
22 |
+
|
23 |
if __name__ == "__main__":
|
24 |
import uvicorn
|
25 |
uvicorn.run("server:app", host=API_HOST, port=API_PORT, reload=True)
|