import React, { useEffect, useState } from "react"; import { apiClient, SystemInfo } from "../apiClient"; import "../static/style.css"; // Ensure the main CSS file is imported const PerformanceTracking: React.FC = () => { const [systemInfo, setSystemInfo] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { const fetchSystemInfo = async () => { try { setLoading(true); setError(null); const info = await apiClient.getSystemInfo(); setSystemInfo(info); } catch (err) { setError( err instanceof Error ? err.message : "Failed to load system info" ); } finally { setLoading(false); } }; fetchSystemInfo(); }, []); if (loading) { return (
Loading Performance Data...
); } if (error) { return
{error}
; } if (!systemInfo) { return (

No system information could be loaded.

); } return (
{/* --- System Health Card --- */}

System Health

{systemInfo.version}
{systemInfo.system_health.models_loaded} /{" "} {systemInfo.system_health.total_models}
{systemInfo.system_health.memory_usage_mb.toFixed(1)} MB
{systemInfo.system_health.torch_version}
{systemInfo.system_health.cuda_available ? "Yes" : "No"}
{systemInfo.max_batch_size}
{/* --- Model Performance Card --- */}

Available Models

{(systemInfo.available_models || []).map((model) => (

{model.display_name || model.name}

Accuracy {((model.performance?.accuracy ?? 0) * 100).toFixed(1)}%
F1 Score {((model.performance?.f1_score ?? 0) * 100).toFixed(1)}%
Params {model.parameters || "N/A"}
Status {model.available ? "Available" : "Unavailable"}

{model.description}

))}
{/* --- Supported Features Card --- */}

Supported Features

{systemInfo.supported_modalities?.join(", ") ?? "N/A"}
{systemInfo.target_spectrum_length} points
.txt, .csv, .json
Single, Batch, Comparison
); }; export default PerformanceTracking;