import React, { useState, useEffect } from "react"; import { Box, Paper, Typography, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Alert, CircularProgress, Card, CardContent, Link, Tooltip, } from "@mui/material"; import OpenInNewIcon from "@mui/icons-material/OpenInNew"; import CheckCircleIcon from "@mui/icons-material/CheckCircle"; import ErrorDisplay from "../common/ErrorDisplay"; // Styles pour les médailles const MEDAL_STYLES = { 1: { color: "#B58A1B", background: "linear-gradient(135deg, #FFF7E0 0%, #FFD700 100%)", borderColor: "rgba(212, 160, 23, 0.35)", shadowColor: "rgba(212, 160, 23, 0.8)", }, 2: { color: "#667380", background: "linear-gradient(135deg, #FFFFFF 0%, #D8E3ED 100%)", borderColor: "rgba(124, 139, 153, 0.35)", shadowColor: "rgba(124, 139, 153, 0.8)", }, 3: { color: "#B85C2F", background: "linear-gradient(135deg, #FDF0E9 0%, #FFBC8C 100%)", borderColor: "rgba(204, 108, 61, 0.35)", shadowColor: "rgba(204, 108, 61, 0.8)", }, default: { color: "text.primary", background: "transparent", borderColor: "transparent", shadowColor: "transparent", }, }; // Fonction pour obtenir le style de médaille en fonction du rang const getMedalStyle = (rank) => { if (rank <= 3) { const medalStyle = MEDAL_STYLES[rank]; return { color: medalStyle.color, fontWeight: 900, fontFamily: '"Inter", -apple-system, sans-serif', width: "24px", height: "24px", background: medalStyle.background, border: "1px solid", borderColor: medalStyle.borderColor, borderRadius: "50%", display: "flex", alignItems: "center", justifyContent: "center", fontSize: "0.95rem", lineHeight: 1, padding: 0, boxShadow: `1px 1px 0 ${medalStyle.shadowColor}`, marginRight: "8px", }; } // Pour les rangs > 3, même dimensions mais transparent return { color: "text.primary", fontWeight: rank <= 10 ? 600 : 400, width: "24px", height: "24px", display: "flex", alignItems: "center", justifyContent: "center", fontSize: "0.95rem", marginRight: "8px", }; }; const Display = ({ sessionId, results }) => { // Format accuracy as percentage const formatAccuracy = (value) => { return `${(value * 100).toFixed(2)}\u2009%`; }; // Fonction pour obtenir une couleur en fonction du score (rouge au vert) const getColorForScore = (score) => { // Convertir en pourcentage (0-100) const percent = score * 100; // Calcul de la couleur: rouge (0%) à vert (100%) // Rouge diminue, vert augmente const red = Math.max( 0, Math.min(255, Math.round(255 * (1 - percent / 100))) ); const green = Math.max(0, Math.min(255, Math.round(255 * (percent / 100)))); return `rgb(${red}, ${green}, 0)`; }; // Format evaluation time const formatTime = (seconds) => { return `${seconds.toFixed(2)}s`; }; if ( !results || !results.models_comparison || results.models_comparison.length === 0 ) { return ( ); } // Vérifier s'il n'y a aucun modèle réussi const successfulModels = results.models_comparison.filter( (model) => model.success ); if (successfulModels.length === 0) { return ( ); } return ( <> Evaluation finished successfully The best models for this benchmark are Rank Model Accuracy Eval Time Status {successfulModels.map((model, index) => ( {index + 1} {model.model_name.length > 40 ? `${model.model_name.substring(0, 40)}...` : model.model_name} 0.7 ? "bold" : "normal", py: 1.5, textAlign: "left", }} > {formatAccuracy(model.accuracy)} {formatTime(model.evaluation_time)} ✓ Success ))}
Need larger evaluation?{" "} Go to this page ); }; export default Display;