Limit to 20 frames and rework analyze page layout
Browse files49 unmodified lines50515253535455565726 unmodified lines8485868687878889909153 unmodified lines1451461471471481491501511521481491501 unmodified line15215315416015515615715815916416016116216316416516716616716816917017117217317417549 unmodified lines const formData = new FormData(); formData.append("video", videoFile); const base = backendUrl || ""; // empty means same origin // Request 20 frames to match preprocessing const url = `${base}/api/infer?frame_rate=5&max_frames=50`; const 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-3 gap-6"> <section className="lg:col-span-2 space-y-4"> <div className="grid lg:grid-cols-2 gap-6 items-start"> <section className="space-y-4"> <div onDrop={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"> <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 score: {result.final_score.toFixed(3)}</span> <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">Run analysis to see results here.</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