Limit to 20 frames and rework analyze page layout
Browse files49 unmodified lines5051525354555626 unmodified lines838485868788899053 unmodified lines1441451461471481491501511521531541551 unmodified line15715815916016116216316416516616716816917049 unmodified linesconst formData = new FormData();formData.append("video", videoFile);const base = backendUrl || ""; // empty means same originconst url = `${base}/api/infer?frame_rate=5&max_frames=50`;const res = await fetch(url, { method: "POST", body: formData });if (!res.ok) {const text = await res.text();26 unmodified lines</header><main className="max-w-7xl mx-auto px-4 py-6 space-y-6"><div className="grid lg:grid-cols-3 gap-6"><section className="lg:col-span-2 space-y-4"><divonDrop={onDrop}onDragOver={onDragOver}53 unmodified lines{!videoFile && <span className="text-sm text-gray-600 dark:text-gray-400">Select a video to start.</span>}</form>{result && (<div className="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-5 shadow-sm"><h2 className="text-lg font-semibold mb-4">Extracted Frames & Predictions</h2><FrameGrid frames={result.frames} predictions={result.predictions} /></div>)}</section><aside className="space-y-4">1 unmodified line<h2 className="text-lg font-semibold mb-2">Final Conclusion</h2><p className="text-sm text-gray-600 dark:text-gray-400 mb-3">Aggregated across all extracted frames</p>{result ? (<div className="flex items-center gap-3"><span className={`px-3 py-1.5 rounded text-white text-sm ${result.final_label === 'fake' ? 'bg-red-500' : 'bg-green-600'}`}>{result.final_label.toUpperCase()}</span><span className="text-sm text-gray-700 dark:text-gray-300">avg score: {result.final_score.toFixed(3)}</span></div>) : (<div className="text-sm text-gray-500 dark:text-gray-400">Run analysis to see results here.</div>)}</div></aside>49 unmodified lines505152535455565726 unmodified lines848586878889909153 unmodified lines1451461471481491501 unmodified line15215315415515615715815916016116216316416516616716816917017117217317417549 unmodified linesconst formData = new FormData();formData.append("video", videoFile);const base = backendUrl || ""; // empty means same origin// Request 20 frames to match preprocessingconst url = `${base}/api/infer?frame_rate=5&max_frames=20`;const res = await fetch(url, { method: "POST", body: formData });if (!res.ok) {const text = await res.text();26 unmodified lines</header><main className="max-w-7xl mx-auto px-4 py-6 space-y-6"><div className="grid lg:grid-cols-2 gap-6 items-start"><section className="space-y-4"><divonDrop={onDrop}onDragOver={onDragOver}53 unmodified lines{!videoFile && <span className="text-sm text-gray-600 dark:text-gray-400">Select a video to start.</span>}</form></section><aside className="space-y-4">1 unmodified line<h2 className="text-lg font-semibold mb-2">Final Conclusion</h2><p className="text-sm text-gray-600 dark:text-gray-400 mb-3">Aggregated across all extracted frames</p>{result ? (<div className="flex items-center gap-3 mb-3"><span className={`px-3 py-1.5 rounded text-white text-sm ${result.final_label === 'fake' ? 'bg-red-500' : 'bg-green-600'}`}>{result.final_label.toUpperCase()}</span>{result.final_label === 'fake' && (<span className="text-sm text-gray-700 dark:text-gray-300">avg fake prob: {result.final_score.toFixed(3)}</span>)}</div>) : (<div className="text-sm text-gray-500 dark:text-gray-400 mb-3">Run analysis to see results here.</div>)}{result && (<div className="border-t border-gray-200 dark:border-gray-700 mt-3 pt-3 max-h-[480px] overflow-y-auto"><h3 className="text-sm font-semibold mb-2">Frames & predictions</h3><FrameGrid frames={result.frames} predictions={result.predictions} /></div>)}</div></aside>
frontend/pages/analyze.jsx+17-12