Add circular bar to analyze
Browse files202 unmodified lines203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237202 unmodified lines<p className="text-sm text-emerald-200/80 mb-3">Overall confidence based on all faces found.</p>{result ? ((() => {const fakeProb = typeof result.final_score === "number" ? result.final_score : 0;const realProb = 1 - fakeProb;const isFake = result.final_label === "fake";const percent = Math.round((isFake ? fakeProb : realProb) * 100);const labelText = isFake ? "FAKE" : "REAL";const barColor = isFake ? "bg-red-500" : "bg-emerald-500";return (<div className="space-y-3"><div className="flex items-center justify-between text-xs font-mono text-emerald-200/80"><span>{labelText} confidence</span><span>{isNaN(percent) ? '-' : `${percent}%`}</span></div><div className="flex items-end gap-4 h-28"><div className="flex-1 flex items-end justify-center"><div className="h-full w-4 rounded-full bg-slate-800 overflow-hidden border border-slate-700"><divclassName={`${barColor} w-full transition-all`}style={{ height: `${Math.max(0, Math.min(100, isNaN(percent) ? 0 : percent))}%` }}/></div></div><div className="text-[11px] text-emerald-200/80 space-y-1"><div>REAL: {realProb.toFixed(3)}</div><div>FAKE: {fakeProb.toFixed(3)}</div></div></div><p className="text-xs text-emerald-300/80">Taller bar means stronger confidence that this video is {labelText.toLowerCase()}.</p></div>);})()202 unmodified lines203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254202 unmodified lines<p className="text-sm text-emerald-200/80 mb-3">Overall confidence based on all faces found.</p>{result ? ((() => {const rawScore =typeof result.final_score === "number"? result.final_score: Number(result.final_score) || 0;const fakeProb = Math.max(0, Math.min(1, rawScore));const realProb = 1 - fakeProb;const isFake = result.final_label === "fake";const percent = Math.round(fakeProb * 100);const labelText = isFake ? "FAKE" : "REAL";const primaryColor = isFake ? "#ef4444" : "#22c55e"; // red-500 or emerald-500const trackColor = "#020617"; // slate-950const safePercent = isNaN(percent) ? 0 : Math.max(0, Math.min(100, percent));const angle = (safePercent / 100) * 360;return (<div className="space-y-4"><div className="flex items-center justify-between text-xs font-mono text-emerald-200/80"><span>Fake probability</span><span>{isNaN(percent) ? "-" : `${safePercent}%`}</span></div><div className="flex items-center gap-5"><divclassName="relative h-28 w-28 rounded-full flex items-center justify-center mx-auto"style={{background: `conic-gradient(${primaryColor} ${angle}deg, ${trackColor} ${angle}deg)`,}}><div className="h-20 w-20 rounded-full bg-slate-950 flex flex-col items-center justify-center border border-slate-700"><span className="text-[10px] font-mono text-emerald-200/80">{labelText}</span><span className="text-sm font-semibold">{isNaN(percent) ? "-" : `${safePercent}%`}</span></div></div><div className="text-[11px] text-emerald-200/80 space-y-1"><div>REAL: {realProb.toFixed(3)}</div><div>FAKE: {fakeProb.toFixed(3)}</div><div className="text-emerald-300/80 text-[10px]">Circle shows how much of the model's belief is fake.</div></div></div></div>);})()
frontend/pages/analyze.jsx+33-16