import React, { useState, useEffect } from 'react';
import _ from 'lodash';
const ScoreBar = ({ score }) => {
const percentage = score <= 1 ? score * 100 : score;
const hue = Math.min(percentage * 1.2, 120); // 0 = red, 120 = green
const backgroundColor = `hsl(${hue}, 70%, 45%)`;
return (
);
};
function App() {
const [data, setData] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [sortConfig, setSortConfig] = useState({ key: 'GAIA', direction: 'desc' });
useEffect(() => {
const fetchData = async () => {
try {
setLoading(true);
const response = await fetch('/api/results');
if (!response.ok) {
throw new Error('Failed to fetch data');
}
const jsonData = await response.json();
setData(jsonData);
} catch (err) {
console.error('Error fetching data:', err);
setError(err.message);
} finally {
setLoading(false);
}
};
fetchData();
}, []);
const handleSort = (key) => {
const direction = sortConfig.key === key && sortConfig.direction === 'desc' ? 'asc' : 'desc';
setSortConfig({ key, direction });
};
const sortedData = _.orderBy(
data,
[item => item.scores[sortConfig.key] || 0],
[sortConfig.direction]
);
const getSortIcon = (key) => {
if (sortConfig.key === key) {
return sortConfig.direction === 'desc' ? ' ↓' : ' ↑';
}
return ' ↕';
};
if (loading) {
return (
Loading benchmark results...
);
}
if (error) {
return (
Error: {error}
);
}
return (
Model Benchmark Results
Comparing model performance across different benchmarks
Model |
{["GAIA", "MATH", "SimpleQA"].map(benchmark => (
handleSort(benchmark)}
className="py-3 px-4 text-left font-medium text-gray-700 cursor-pointer hover:text-blue-600"
>
{benchmark}
{getSortIcon(benchmark)}
|
))}
{sortedData.map((item, index) => (
{item.model_id}
|
|
|
|
))}
);
}
export default App;