Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
feat(login): add internationalisation to login comonents
Browse files
frontend/src/components/shared/AuthContainer.jsx
DELETED
@@ -1,139 +0,0 @@
|
|
1 |
-
import React from "react";
|
2 |
-
import {
|
3 |
-
Box,
|
4 |
-
Typography,
|
5 |
-
Button,
|
6 |
-
Chip,
|
7 |
-
Stack,
|
8 |
-
Paper,
|
9 |
-
CircularProgress,
|
10 |
-
} from "@mui/material";
|
11 |
-
import HFLogo from "../Logo/HFLogo";
|
12 |
-
import { useAuth } from "../../hooks/useAuth";
|
13 |
-
import LogoutIcon from "@mui/icons-material/Logout";
|
14 |
-
import { useNavigate } from "react-router-dom";
|
15 |
-
|
16 |
-
function AuthContainer({ actionText = "DO_ACTION" }) {
|
17 |
-
const { isAuthenticated, user, login, logout, loading } = useAuth();
|
18 |
-
const navigate = useNavigate();
|
19 |
-
|
20 |
-
const handleLogout = () => {
|
21 |
-
if (isAuthenticated && logout) {
|
22 |
-
logout();
|
23 |
-
navigate("/", { replace: true });
|
24 |
-
window.location.reload();
|
25 |
-
}
|
26 |
-
};
|
27 |
-
|
28 |
-
if (loading) {
|
29 |
-
return (
|
30 |
-
<Paper
|
31 |
-
elevation={0}
|
32 |
-
sx={{
|
33 |
-
p: 3,
|
34 |
-
mb: 4,
|
35 |
-
border: "1px solid",
|
36 |
-
borderColor: "grey.300",
|
37 |
-
display: "flex",
|
38 |
-
flexDirection: "column",
|
39 |
-
alignItems: "center",
|
40 |
-
gap: 2,
|
41 |
-
}}
|
42 |
-
>
|
43 |
-
<CircularProgress size={24} />
|
44 |
-
</Paper>
|
45 |
-
);
|
46 |
-
}
|
47 |
-
|
48 |
-
if (!isAuthenticated) {
|
49 |
-
return (
|
50 |
-
<Paper
|
51 |
-
elevation={0}
|
52 |
-
sx={{
|
53 |
-
p: 3,
|
54 |
-
mb: 4,
|
55 |
-
border: "1px solid",
|
56 |
-
borderColor: "grey.300",
|
57 |
-
display: "flex",
|
58 |
-
flexDirection: "column",
|
59 |
-
alignItems: "center",
|
60 |
-
gap: 2,
|
61 |
-
}}
|
62 |
-
>
|
63 |
-
<Typography variant="h6" align="center">
|
64 |
-
Login to {actionText}
|
65 |
-
</Typography>
|
66 |
-
<Typography variant="body2" color="text.secondary" align="center">
|
67 |
-
You need to be logged in with your Hugging Face account to{" "}
|
68 |
-
{actionText.toLowerCase()}
|
69 |
-
</Typography>
|
70 |
-
<Button
|
71 |
-
variant="contained"
|
72 |
-
onClick={login}
|
73 |
-
startIcon={
|
74 |
-
<Box
|
75 |
-
sx={{
|
76 |
-
width: 20,
|
77 |
-
height: 20,
|
78 |
-
display: "flex",
|
79 |
-
alignItems: "center",
|
80 |
-
}}
|
81 |
-
>
|
82 |
-
<HFLogo />
|
83 |
-
</Box>
|
84 |
-
}
|
85 |
-
sx={{
|
86 |
-
textTransform: "none",
|
87 |
-
fontWeight: 600,
|
88 |
-
py: 1,
|
89 |
-
px: 2,
|
90 |
-
}}
|
91 |
-
>
|
92 |
-
Sign in with Hugging Face
|
93 |
-
</Button>
|
94 |
-
</Paper>
|
95 |
-
);
|
96 |
-
}
|
97 |
-
|
98 |
-
return (
|
99 |
-
<Paper
|
100 |
-
elevation={0}
|
101 |
-
sx={{ p: 2, border: "1px solid", borderColor: "grey.300", mb: 4 }}
|
102 |
-
>
|
103 |
-
<Stack
|
104 |
-
direction="row"
|
105 |
-
spacing={2}
|
106 |
-
alignItems="center"
|
107 |
-
justifyContent="space-between"
|
108 |
-
>
|
109 |
-
<Stack direction="row" spacing={1} alignItems="center">
|
110 |
-
<Typography variant="body1">
|
111 |
-
Connected as <strong>{user?.username}</strong>
|
112 |
-
</Typography>
|
113 |
-
<Chip
|
114 |
-
label={`Ready to ${actionText}`}
|
115 |
-
color="success"
|
116 |
-
size="small"
|
117 |
-
variant="outlined"
|
118 |
-
/>
|
119 |
-
</Stack>
|
120 |
-
<Button
|
121 |
-
variant="contained"
|
122 |
-
onClick={handleLogout}
|
123 |
-
endIcon={<LogoutIcon />}
|
124 |
-
color="primary"
|
125 |
-
sx={{
|
126 |
-
minWidth: 120,
|
127 |
-
height: 36,
|
128 |
-
textTransform: "none",
|
129 |
-
fontSize: "0.9375rem",
|
130 |
-
}}
|
131 |
-
>
|
132 |
-
Logout
|
133 |
-
</Button>
|
134 |
-
</Stack>
|
135 |
-
</Paper>
|
136 |
-
);
|
137 |
-
}
|
138 |
-
|
139 |
-
export default AuthContainer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/src/i18n.tsx
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import { createI18nApi, declareComponentKeys } from "i18nifty";
|
|
|
2 |
export {declareComponentKeys};
|
3 |
|
4 |
//List the languages you with to support
|
@@ -21,9 +22,10 @@ export const {
|
|
21 |
/** For use outside of React */
|
22 |
getTranslation,
|
23 |
} = createI18nApi<
|
24 |
-
|
|
25 |
| import ("components/Header/Header").I18n
|
26 |
| import ("components/Navigation/Navigation").I18n
|
|
|
27 |
>()(
|
28 |
{
|
29 |
languages,
|
@@ -31,16 +33,6 @@ export const {
|
|
31 |
},
|
32 |
{
|
33 |
"en": {
|
34 |
-
"LeaderboardPage": {
|
35 |
-
"greating": ({ who })=> `Hello ${who}`,
|
36 |
-
"how are you": "How are you feeling today?",
|
37 |
-
"learn more": ({ href }) => (
|
38 |
-
<>
|
39 |
-
Learn more about
|
40 |
-
<a href={href}>this website</a>.
|
41 |
-
</>
|
42 |
-
)
|
43 |
-
},
|
44 |
"header": {
|
45 |
"tagline": "Benchmark for large language models in French",
|
46 |
"service": "LLM leaderboard for the French language"
|
@@ -48,20 +40,25 @@ export const {
|
|
48 |
"Navigation": {
|
49 |
"submit": "Submit",
|
50 |
"about": "About"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
},
|
53 |
/* spell-checker: disable */
|
54 |
"fr": {
|
55 |
-
"LeaderboardPage": {
|
56 |
-
"greating": ({ who })=> `Bonjour ${who}`,
|
57 |
-
"how are you": "Comment vous sentez vous au jour d'hui?",
|
58 |
-
"learn more": ({ href }) => (
|
59 |
-
<>
|
60 |
-
En savoir plus à propos de
|
61 |
-
<a href={href}>ce site web</a>.
|
62 |
-
</>
|
63 |
-
)
|
64 |
-
},
|
65 |
"header": {
|
66 |
"tagline": "Comparaison de modèles d'IA génératifs sur des jeux de données adaptés à la langue française",
|
67 |
"service": "Leaderboard des modèles de langage pour le français"
|
@@ -69,6 +66,21 @@ export const {
|
|
69 |
"Navigation": {
|
70 |
"submit": "Soumettre",
|
71 |
"about": "A propos"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
}
|
74 |
/* spell-checker: enable */
|
|
|
1 |
import { createI18nApi, declareComponentKeys } from "i18nifty";
|
2 |
+
import { Typography } from "@mui/material";
|
3 |
export {declareComponentKeys};
|
4 |
|
5 |
//List the languages you with to support
|
|
|
22 |
/** For use outside of React */
|
23 |
getTranslation,
|
24 |
} = createI18nApi<
|
25 |
+
| import ("pages/AddModelPage/AddModelPage").I18n
|
26 |
| import ("components/Header/Header").I18n
|
27 |
| import ("components/Navigation/Navigation").I18n
|
28 |
+
| import ("components/shared/AuthContainer").I18n
|
29 |
>()(
|
30 |
{
|
31 |
languages,
|
|
|
33 |
},
|
34 |
{
|
35 |
"en": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
"header": {
|
37 |
"tagline": "Benchmark for large language models in French",
|
38 |
"service": "LLM leaderboard for the French language"
|
|
|
40 |
"Navigation": {
|
41 |
"submit": "Submit",
|
42 |
"about": "About"
|
43 |
+
},
|
44 |
+
"AddModelPage": {
|
45 |
+
"title": "Submit a model for evaluation",
|
46 |
+
"subtitle": "Add your model to the LLM leaderboard for the French language."
|
47 |
+
},
|
48 |
+
"AuthContainer": {
|
49 |
+
"login": "Login to submit a model",
|
50 |
+
"need": "You need to be logged in with your Hugging Face account to submit a model",
|
51 |
+
"logout": "Logout",
|
52 |
+
"button": "Sign in with Hugging Face",
|
53 |
+
"loggedin": ({user}) => (
|
54 |
+
<Typography variant="body1">
|
55 |
+
Connected as <strong>{user}</strong>
|
56 |
+
</Typography>
|
57 |
+
)
|
58 |
}
|
59 |
},
|
60 |
/* spell-checker: disable */
|
61 |
"fr": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
"header": {
|
63 |
"tagline": "Comparaison de modèles d'IA génératifs sur des jeux de données adaptés à la langue française",
|
64 |
"service": "Leaderboard des modèles de langage pour le français"
|
|
|
66 |
"Navigation": {
|
67 |
"submit": "Soumettre",
|
68 |
"about": "A propos"
|
69 |
+
},
|
70 |
+
"AddModelPage": {
|
71 |
+
"title": "Soumettre un modele a l'evaluation",
|
72 |
+
"subtitle": "Ajoutez votre modele au leaderboard des modeles de langage pour le francais"
|
73 |
+
},
|
74 |
+
"AuthContainer": {
|
75 |
+
"login": "Se connecter pour soumettre un modele",
|
76 |
+
"need": "Il vous faut vous connecter avec votre compte Hugging Face pour soumettre un modele",
|
77 |
+
"logout": "Se deconnecter",
|
78 |
+
"button": "Se connecter avec Hugging Face",
|
79 |
+
"loggedin": ({user}) => (
|
80 |
+
<Typography variant="body1">
|
81 |
+
Connecte en tant que <strong>{user}</strong>
|
82 |
+
</Typography>
|
83 |
+
)
|
84 |
}
|
85 |
}
|
86 |
/* spell-checker: enable */
|
frontend/src/pages/AddModelPage/AddModelPage.jsx
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
import React from "react";
|
2 |
-
import { Box, CircularProgress } from "@mui/material";
|
3 |
-
import { useAuth } from "../../hooks/useAuth";
|
4 |
-
import PageHeader from "../../components/shared/PageHeader";
|
5 |
-
import EvaluationQueues from "./components/EvaluationQueues/EvaluationQueues";
|
6 |
-
import ModelSubmissionForm from "./components/ModelSubmissionForm/ModelSubmissionForm";
|
7 |
-
import SubmissionGuide from "./components/SubmissionGuide/SubmissionGuide";
|
8 |
-
|
9 |
-
function AddModelPage() {
|
10 |
-
const { isAuthenticated, loading, user } = useAuth();
|
11 |
-
|
12 |
-
if (loading) {
|
13 |
-
return (
|
14 |
-
<Box
|
15 |
-
sx={{
|
16 |
-
display: "flex",
|
17 |
-
justifyContent: "center",
|
18 |
-
alignItems: "center",
|
19 |
-
height: "100vh",
|
20 |
-
}}
|
21 |
-
>
|
22 |
-
<CircularProgress />
|
23 |
-
</Box>
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
return (
|
28 |
-
<Box sx={{ width: "100%", maxWidth: 1200, margin: "0 auto", padding: 4 }}>
|
29 |
-
<PageHeader
|
30 |
-
title="Submit a Model for Evaluation"
|
31 |
-
subtitle={
|
32 |
-
<>
|
33 |
-
Add <span style={{ fontWeight: 600 }}>your</span> model to the Open
|
34 |
-
LLM Leaderboard
|
35 |
-
</>
|
36 |
-
}
|
37 |
-
/>
|
38 |
-
|
39 |
-
<SubmissionGuide />
|
40 |
-
|
41 |
-
<ModelSubmissionForm user={user} isAuthenticated={isAuthenticated} />
|
42 |
-
|
43 |
-
<EvaluationQueues defaultExpanded={false} />
|
44 |
-
</Box>
|
45 |
-
);
|
46 |
-
}
|
47 |
-
|
48 |
-
export default AddModelPage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/src/pages/AddModelPage/components/SubmissionGuide/SubmissionGuide.jsx
CHANGED
@@ -52,6 +52,10 @@ const StepNumber = ({ number }) => (
|
|
52 |
</Box>
|
53 |
);
|
54 |
|
|
|
|
|
|
|
|
|
55 |
const LOCALIZED_STEPS = {
|
56 |
STEP1: {
|
57 |
TITLE: {
|
@@ -375,7 +379,7 @@ function SubmissionGuide() {
|
|
375 |
variant="h6"
|
376 |
sx={{ fontWeight: 600, color: "text.primary" }}
|
377 |
>
|
378 |
-
|
379 |
</Typography>
|
380 |
<ExpandMoreIcon
|
381 |
sx={{
|
|
|
52 |
</Box>
|
53 |
);
|
54 |
|
55 |
+
const TITLE = {
|
56 |
+
"en": "Submission guide",
|
57 |
+
"fr": "Guide de soumission"
|
58 |
+
}
|
59 |
const LOCALIZED_STEPS = {
|
60 |
STEP1: {
|
61 |
TITLE: {
|
|
|
379 |
variant="h6"
|
380 |
sx={{ fontWeight: 600, color: "text.primary" }}
|
381 |
>
|
382 |
+
{resolveLocalizedString(TITLE)}
|
383 |
</Typography>
|
384 |
<ExpandMoreIcon
|
385 |
sx={{
|