Update frontend/src/App.js
Browse files- frontend/src/App.js +27 -23
frontend/src/App.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
import React, { useState, useEffect } from 'react';
|
2 |
-
import
|
3 |
import './App.css';
|
4 |
|
5 |
const ScoreBar = ({ score }) => {
|
|
|
|
|
6 |
const percentage = score <= 1 ? score * 100 : score;
|
7 |
const hue = Math.min(percentage * 1.2, 120); // Maps 0-100% to 0-120 (red to green)
|
8 |
const backgroundColor = `hsl(${hue}, 80%, 50%)`;
|
@@ -10,18 +12,20 @@ const ScoreBar = ({ score }) => {
|
|
10 |
return (
|
11 |
<div className="score-bar">
|
12 |
<div
|
13 |
-
className="score-fill"
|
14 |
style={{
|
15 |
width: `${percentage}%`,
|
16 |
-
backgroundColor
|
17 |
-
}}
|
18 |
/>
|
19 |
-
<span className="score-text">
|
|
|
|
|
20 |
</div>
|
21 |
);
|
22 |
};
|
23 |
|
24 |
-
|
25 |
const [data, setData] = useState([]);
|
26 |
const [loading, setLoading] = useState(true);
|
27 |
const [error, setError] = useState(null);
|
@@ -45,7 +49,6 @@ function App() {
|
|
45 |
setLoading(false);
|
46 |
}
|
47 |
};
|
48 |
-
|
49 |
fetchData();
|
50 |
}, []);
|
51 |
|
@@ -54,12 +57,15 @@ function App() {
|
|
54 |
setSortConfig({ key, direction });
|
55 |
};
|
56 |
|
57 |
-
const filteredAndSortedData =
|
58 |
-
.filter(item =>
|
59 |
-
item.model_id.toLowerCase().includes(searchQuery.toLowerCase())
|
60 |
-
)
|
61 |
.orderBy(
|
62 |
-
[item =>
|
|
|
|
|
|
|
|
|
|
|
63 |
[sortConfig.direction]
|
64 |
)
|
65 |
.value();
|
@@ -73,7 +79,7 @@ function App() {
|
|
73 |
<h1 className="title">Smolagents Leaderboard</h1>
|
74 |
<p className="subtitle">How do different LLMs compare for powering agents?</p>
|
75 |
</div>
|
76 |
-
|
77 |
<div className="search-container">
|
78 |
<input
|
79 |
type="text"
|
@@ -94,11 +100,8 @@ function App() {
|
|
94 |
)}
|
95 |
</th>
|
96 |
{["Average", "GAIA", "MATH", "SimpleQA"].map(benchmark => (
|
97 |
-
<th
|
98 |
-
|
99 |
-
onClick={() => handleSort(benchmark)}
|
100 |
-
>
|
101 |
-
{benchmark} {sortConfig.key !== benchmark && '-'} {sortConfig.key === benchmark && (
|
102 |
sortConfig.direction === 'desc' ? 'β' : 'β'
|
103 |
)}
|
104 |
</th>
|
@@ -109,10 +112,11 @@ function App() {
|
|
109 |
{filteredAndSortedData.map((item, index) => (
|
110 |
<tr key={index}>
|
111 |
<td className="model-name">{item.model_id}</td>
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
116 |
</tr>
|
117 |
))}
|
118 |
</tbody>
|
@@ -120,6 +124,6 @@ function App() {
|
|
120 |
</div>
|
121 |
</div>
|
122 |
);
|
123 |
-
}
|
124 |
|
125 |
export default App;
|
|
|
1 |
import React, { useState, useEffect } from 'react';
|
2 |
+
import { chain } from 'lodash';
|
3 |
import './App.css';
|
4 |
|
5 |
const ScoreBar = ({ score }) => {
|
6 |
+
if (score === undefined || score === null) return null;
|
7 |
+
|
8 |
const percentage = score <= 1 ? score * 100 : score;
|
9 |
const hue = Math.min(percentage * 1.2, 120); // Maps 0-100% to 0-120 (red to green)
|
10 |
const backgroundColor = `hsl(${hue}, 80%, 50%)`;
|
|
|
12 |
return (
|
13 |
<div className="score-bar">
|
14 |
<div
|
15 |
+
className="score-fill"
|
16 |
style={{
|
17 |
width: `${percentage}%`,
|
18 |
+
backgroundColor
|
19 |
+
}}
|
20 |
/>
|
21 |
+
<span className="score-text">
|
22 |
+
{percentage.toFixed(1)}%
|
23 |
+
</span>
|
24 |
</div>
|
25 |
);
|
26 |
};
|
27 |
|
28 |
+
const App = () => {
|
29 |
const [data, setData] = useState([]);
|
30 |
const [loading, setLoading] = useState(true);
|
31 |
const [error, setError] = useState(null);
|
|
|
49 |
setLoading(false);
|
50 |
}
|
51 |
};
|
|
|
52 |
fetchData();
|
53 |
}, []);
|
54 |
|
|
|
57 |
setSortConfig({ key, direction });
|
58 |
};
|
59 |
|
60 |
+
const filteredAndSortedData = chain(data)
|
61 |
+
.filter(item => item.model_id.toLowerCase().includes(searchQuery.toLowerCase()))
|
|
|
|
|
62 |
.orderBy(
|
63 |
+
[item => {
|
64 |
+
if (sortConfig.key === 'model') {
|
65 |
+
return item.model_id;
|
66 |
+
}
|
67 |
+
return item.scores[sortConfig.key] || 0;
|
68 |
+
}],
|
69 |
[sortConfig.direction]
|
70 |
)
|
71 |
.value();
|
|
|
79 |
<h1 className="title">Smolagents Leaderboard</h1>
|
80 |
<p className="subtitle">How do different LLMs compare for powering agents?</p>
|
81 |
</div>
|
82 |
+
|
83 |
<div className="search-container">
|
84 |
<input
|
85 |
type="text"
|
|
|
100 |
)}
|
101 |
</th>
|
102 |
{["Average", "GAIA", "MATH", "SimpleQA"].map(benchmark => (
|
103 |
+
<th key={benchmark} onClick={() => handleSort(benchmark)}>
|
104 |
+
{benchmark} {sortConfig.key === benchmark && (
|
|
|
|
|
|
|
105 |
sortConfig.direction === 'desc' ? 'β' : 'β'
|
106 |
)}
|
107 |
</th>
|
|
|
112 |
{filteredAndSortedData.map((item, index) => (
|
113 |
<tr key={index}>
|
114 |
<td className="model-name">{item.model_id}</td>
|
115 |
+
{["Average", "GAIA", "MATH", "SimpleQA"].map(metric => (
|
116 |
+
<td key={metric}>
|
117 |
+
<ScoreBar score={item.scores[metric]} />
|
118 |
+
</td>
|
119 |
+
))}
|
120 |
</tr>
|
121 |
))}
|
122 |
</tbody>
|
|
|
124 |
</div>
|
125 |
</div>
|
126 |
);
|
127 |
+
};
|
128 |
|
129 |
export default App;
|