import { DownloadIcon, InfoIcon, Loader2Icon } from "lucide-react"; interface ResultsPanelProps { uploadedImage: string | null; result?: any; loading?: boolean; } export function ResultsPanel({ uploadedImage, result, loading }: ResultsPanelProps) { if (loading) { return (

Analyzing image...

); } if (!result) { return (
No analysis result available yet.
); } const { prediction, confidence, probabilities, detections, summary, annotated_image_url, model_name, analysis_type, } = result; const handleDownload = () => { if (annotated_image_url) { const link = document.createElement("a"); link.href = annotated_image_url; link.download = "analysis_result.jpg"; link.click(); } }; return (
{/* Header */}

{model_name ? model_name.toUpperCase() : "Analysis Result"}

{analysis_type || "Test Type"}

{annotated_image_url && ( )}
{/* Image */}
Analysis Result
{/* Results Summary */}
{prediction && (

{prediction}

)} {confidence && (
Confidence: {(confidence * 100).toFixed(2)}%
0.7 ? "bg-green-500" : confidence > 0.4 ? "bg-yellow-500" : "bg-red-500" }`} style={{ width: `${confidence * 100}%` }} />
)} {summary && (

{summary}

)}
{/* Detections / Probabilities */} {detections && detections.length > 0 && (

Detected Regions:

    {detections.map((det: any, i: number) => (
  • {det.name || "object"} – {(det.confidence * 100).toFixed(1)}%
  • ))}
)} {probabilities && (

Class Probabilities:

        {JSON.stringify(probabilities, null, 2)}
      
)} {/* Report Button */}
); }