Update frontend/src/App.js
Browse files- frontend/src/App.js +71 -55
frontend/src/App.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import React, { useState, useEffect } from 'react';
|
2 |
import _ from 'lodash';
|
|
|
3 |
|
4 |
const ScoreBar = ({ score }) => {
|
5 |
const percentage = score <= 1 ? score * 100 : score;
|
@@ -7,9 +8,9 @@ const ScoreBar = ({ score }) => {
|
|
7 |
const backgroundColor = `hsl(${hue}, 70%, 45%)`;
|
8 |
|
9 |
return (
|
10 |
-
<div className="relative h-
|
11 |
<div
|
12 |
-
className="absolute top-0 left-0 h-full
|
13 |
style={{
|
14 |
width: `${percentage}%`,
|
15 |
backgroundColor
|
@@ -29,17 +30,15 @@ function App() {
|
|
29 |
const [loading, setLoading] = useState(true);
|
30 |
const [error, setError] = useState(null);
|
31 |
const [sortConfig, setSortConfig] = useState({ key: 'GAIA', direction: 'desc' });
|
|
|
32 |
|
33 |
useEffect(() => {
|
34 |
const fetchData = async () => {
|
35 |
try {
|
36 |
setLoading(true);
|
37 |
-
|
38 |
const response = await fetch('https://smolagents-benchmark-smolagents-llm-leaderboard.hf.space/api/results');
|
39 |
-
|
40 |
if (!response.ok) {
|
41 |
-
|
42 |
-
throw new Error(`HTTP error! status: ${response.status}, message: ${text}`);
|
43 |
}
|
44 |
const jsonData = await response.json();
|
45 |
setData(jsonData);
|
@@ -59,18 +58,15 @@ function App() {
|
|
59 |
setSortConfig({ key, direction });
|
60 |
};
|
61 |
|
62 |
-
const
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
}
|
72 |
-
return ' ↕';
|
73 |
-
};
|
74 |
|
75 |
if (loading) {
|
76 |
return (
|
@@ -89,50 +85,70 @@ function App() {
|
|
89 |
}
|
90 |
|
91 |
return (
|
92 |
-
<div className="p-6">
|
93 |
<div className="mb-6">
|
94 |
<h1 className="text-2xl font-bold mb-2">Model Benchmark Results</h1>
|
95 |
<p className="text-gray-600">Comparing model performance across different benchmarks</p>
|
96 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
-
<div className="overflow-
|
99 |
-
<
|
100 |
-
<
|
101 |
-
<
|
102 |
-
<
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
>
|
109 |
-
<
|
110 |
-
{
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
))}
|
115 |
-
</
|
116 |
-
</
|
117 |
-
|
118 |
-
{sortedData.map((item, index) => (
|
119 |
-
<tr key={index} className="border-b border-gray-100">
|
120 |
-
<td className="py-3 pr-4 font-medium truncate" title={item.model_id}>
|
121 |
-
{item.model_id}
|
122 |
-
</td>
|
123 |
-
<td className="py-3 px-4">
|
124 |
-
<ScoreBar score={item.scores.GAIA} />
|
125 |
-
</td>
|
126 |
-
<td className="py-3 px-4">
|
127 |
-
<ScoreBar score={item.scores.MATH} />
|
128 |
-
</td>
|
129 |
-
<td className="py-3 px-4">
|
130 |
-
<ScoreBar score={item.scores.SimpleQA} />
|
131 |
-
</td>
|
132 |
-
</tr>
|
133 |
-
))}
|
134 |
-
</tbody>
|
135 |
-
</table>
|
136 |
</div>
|
137 |
</div>
|
138 |
);
|
|
|
1 |
import React, { useState, useEffect } from 'react';
|
2 |
import _ from 'lodash';
|
3 |
+
import { Search } from 'lucide-react';
|
4 |
|
5 |
const ScoreBar = ({ score }) => {
|
6 |
const percentage = score <= 1 ? score * 100 : score;
|
|
|
8 |
const backgroundColor = `hsl(${hue}, 70%, 45%)`;
|
9 |
|
10 |
return (
|
11 |
+
<div className="relative h-6 bg-gray-200 rounded-full overflow-hidden">
|
12 |
<div
|
13 |
+
className="absolute top-0 left-0 h-full transition-all duration-200"
|
14 |
style={{
|
15 |
width: `${percentage}%`,
|
16 |
backgroundColor
|
|
|
30 |
const [loading, setLoading] = useState(true);
|
31 |
const [error, setError] = useState(null);
|
32 |
const [sortConfig, setSortConfig] = useState({ key: 'GAIA', direction: 'desc' });
|
33 |
+
const [searchQuery, setSearchQuery] = useState('');
|
34 |
|
35 |
useEffect(() => {
|
36 |
const fetchData = async () => {
|
37 |
try {
|
38 |
setLoading(true);
|
|
|
39 |
const response = await fetch('https://smolagents-benchmark-smolagents-llm-leaderboard.hf.space/api/results');
|
|
|
40 |
if (!response.ok) {
|
41 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
|
42 |
}
|
43 |
const jsonData = await response.json();
|
44 |
setData(jsonData);
|
|
|
58 |
setSortConfig({ key, direction });
|
59 |
};
|
60 |
|
61 |
+
const filteredAndSortedData = _.chain(data)
|
62 |
+
.filter(item =>
|
63 |
+
item.model_id.toLowerCase().includes(searchQuery.toLowerCase())
|
64 |
+
)
|
65 |
+
.orderBy(
|
66 |
+
[item => item.scores[sortConfig.key] || 0],
|
67 |
+
[sortConfig.direction]
|
68 |
+
)
|
69 |
+
.value();
|
|
|
|
|
|
|
70 |
|
71 |
if (loading) {
|
72 |
return (
|
|
|
85 |
}
|
86 |
|
87 |
return (
|
88 |
+
<div className="max-w-6xl mx-auto p-6">
|
89 |
<div className="mb-6">
|
90 |
<h1 className="text-2xl font-bold mb-2">Model Benchmark Results</h1>
|
91 |
<p className="text-gray-600">Comparing model performance across different benchmarks</p>
|
92 |
</div>
|
93 |
+
|
94 |
+
<div className="mb-6 relative">
|
95 |
+
<div className="relative">
|
96 |
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" size={20} />
|
97 |
+
<input
|
98 |
+
type="text"
|
99 |
+
placeholder="Search models..."
|
100 |
+
className="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
101 |
+
value={searchQuery}
|
102 |
+
onChange={(e) => setSearchQuery(e.target.value)}
|
103 |
+
/>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
|
107 |
+
<div className="bg-white rounded-lg shadow overflow-hidden">
|
108 |
+
<div className="overflow-x-auto">
|
109 |
+
<table className="w-full border-collapse">
|
110 |
+
<thead>
|
111 |
+
<tr className="bg-gray-50 border-b border-gray-200">
|
112 |
+
<th className="py-3 px-6 text-left font-medium text-gray-700">Model</th>
|
113 |
+
{["GAIA", "MATH", "SimpleQA"].map(benchmark => (
|
114 |
+
<th
|
115 |
+
key={benchmark}
|
116 |
+
onClick={() => handleSort(benchmark)}
|
117 |
+
className="py-3 px-6 text-left font-medium text-gray-700 cursor-pointer hover:text-blue-600"
|
118 |
+
>
|
119 |
+
<div className="flex items-center gap-1">
|
120 |
+
{benchmark}
|
121 |
+
<span className="text-gray-400">-</span>
|
122 |
+
</div>
|
123 |
+
</th>
|
124 |
+
))}
|
125 |
+
</tr>
|
126 |
+
</thead>
|
127 |
+
<tbody>
|
128 |
+
{filteredAndSortedData.map((item, index) => (
|
129 |
+
<tr
|
130 |
+
key={index}
|
131 |
+
className={`border-b border-gray-100 ${
|
132 |
+
index % 2 === 0 ? 'bg-white' : 'bg-gray-50'
|
133 |
+
}`}
|
134 |
>
|
135 |
+
<td className="py-3 px-6 font-medium truncate" title={item.model_id}>
|
136 |
+
{item.model_id}
|
137 |
+
</td>
|
138 |
+
<td className="py-3 px-6">
|
139 |
+
<ScoreBar score={item.scores.GAIA} />
|
140 |
+
</td>
|
141 |
+
<td className="py-3 px-6">
|
142 |
+
<ScoreBar score={item.scores.MATH} />
|
143 |
+
</td>
|
144 |
+
<td className="py-3 px-6">
|
145 |
+
<ScoreBar score={item.scores.SimpleQA} />
|
146 |
+
</td>
|
147 |
+
</tr>
|
148 |
))}
|
149 |
+
</tbody>
|
150 |
+
</table>
|
151 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
</div>
|
153 |
</div>
|
154 |
);
|