New Photos and stuff
Browse filesFiles changed (8)
303 unmodified lines3043053063073073083093103083093103113123133143153163173183193123203213224 unmodified lines327328329323330331332333303 unmodified lines probs = torch.softmax(logits, dim=1).cpu().numpy()
for idx, (orig_frame, (crop, has_face)) in enumerate(zip(frames, crops_info)): if has_face and crop is not None: p_fake = float(probs[idx, 0]) p_real = float(probs[idx, 1]) label = "fake" if p_fake >= p_real else "real" score = p_fake if label == "fake" else p_real p_fake = float(probs[idx, 0]) p_real = float(probs[idx, 1]) label = "fake" if p_fake >= p_real else "real" score = p_fake if label == "fake" else p_real img_for_display = crop else: p_fake = 0.0 p_real = 0.0 label = "no_face" score = 0.0 img_for_display = orig_frame
img_for_display = crop if has_face and crop is not None else orig_frame frame_b64 = b64_encode_image_bgr(img_for_display)
out_frames.append(frame_b64)4 unmodified lines "score": float(score), "prob_real": p_real, "prob_fake": p_fake, "has_face": bool(has_face), "has_face": bool(has_face and crop is not None), } )
12344566789101111121314151612131415161718192021222324252627212829303123 unmodified lines5556575158596061export default function FrameGrid({ frames = [], predictions = [], onFrameClick }) { const items = frames.map((frame, idx) => { const pred = predictions[idx] || {}; const label = (pred.label || "").toLowerCase(); const rawLabel = (pred.label || "").toLowerCase(); const score = typeof pred.score === "number" ? pred.score : pred.prob_fake ?? pred.prob ?? 0; const hasFace = pred.has_face ?? pred.hasFace ?? true; const faceFlag = pred.has_face ?? pred.hasFace; const hasFace = typeof faceFlag === "boolean" ? faceFlag : !(rawLabel === "no face" || rawLabel === "no_face");
// frame may be raw base64 or full data URL const src = frame?.startsWith("data:") ? frame : `data:image/png;base64,${frame || ""}`;
const badgeClass = label === "fake" ? "bg-red-500/90 text-white" : label === "real" ? "bg-green-600/90 text-white" : "bg-gray-400 text-white"; const { badgeClass, displayLabel } = (() => { if (!hasFace) { return { badgeClass: "bg-slate-700/90 text-white", displayLabel: "NO FACE" }; } if (rawLabel === "fake") { return { badgeClass: "bg-red-500/90 text-white", displayLabel: "FAKE" }; } if (rawLabel === "real") { return { badgeClass: "bg-green-600/90 text-white", displayLabel: "REAL" }; } return { badgeClass: "bg-gray-500 text-white", displayLabel: "N/A" }; })();
return { idx, src, label, label: displayLabel, score, hasFace, badgeClass,23 unmodified lines <div className="w-full h-full flex items-center justify-center text-xs md:text-sm text-gray-400">No image</div> )} <span className={`absolute top-1 left-1 px-2 py-0.5 rounded text-[11px] md:text-xs font-semibold ${item.badgeClass}`}> {item.label ? item.label.toUpperCase() : "N/A"} {item.label} </span> </div> <div className="px-2 py-1.5 flex items-center justify-between text-[12px] md:text-sm text-emerald-100/80">1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889import Link from "next/link";
const TEAM = [ { name: "Brian Juniarta Darmadi", role: "AI Engineer & Researcher", photo: "/brian.jpg", }, { name: "Mochammad Aqsa Sandhy Pradipta", role: "Full-Stack Developer & Researcher", photo: "/aqsa.jpg", }, { name: "Jesslyn Trixie Edvilie", role: "AI Engineer & Researcher", photo: "/jess.jpg", },];
export default function About() { return ( <div className="min-h-screen flex flex-col bg-slate-950 text-emerald-50 text-sm md:text-base bg-radial-fade animate-fade-in"> <header className="border-b border-emerald-800/60 bg-slate-950/80 backdrop-blur"> <div className="max-w-7xl mx-auto px-4 py-4 flex items-center justify-between"> <div className="flex items-center gap-3"> <div className="h-9 w-9 rounded-lg bg-emerald-500/20 border border-emerald-500/70 flex items-center justify-center text-emerald-300 font-mono text-sm"> FF </div> <div className="flex flex-col leading-tight"> <span className="text-sm uppercase tracking-[0.2em] text-emerald-400/80">FaceForensics Lab</span> <span className="text-lg font-semibold">Deepfake Detection Console</span> </div> </div> <nav className="flex items-center gap-4 text-xs md:text-sm font-mono text-emerald-200/80"> <Link className="hover:text-emerald-400 transition" href="/"> Home </Link> <Link className="hover:text-emerald-400 transition" href="/analyze"> Analyze </Link> <Link className="hover:text-emerald-400 transition" href="/about"> About </Link> </nav> </div> </header>
<main className="flex-1"> <section className="relative overflow-hidden border-b border-emerald-900/40 py-16 md:py-20"> <div className="absolute inset-0 opacity-[0.07] bg-[linear-gradient(to_right,#10b981_10%,transparent_10%),linear-gradient(to_bottom,#10b981_10%,transparent_10%)] bg-[length:22px_22px]" /> <div className="relative max-w-5xl mx-auto px-4 text-center space-y-4"> <p className="text-xs md:text-sm font-mono uppercase tracking-[0.35em] text-emerald-400/80"> Meet the Team </p> </div> </section>
<section className="max-w-6xl mx-auto px-4 py-12 md:py-16 grid gap-6 md:grid-cols-3"> {TEAM.map((member) => ( <div key={member.name} className="rounded-2xl border border-emerald-800 bg-slate-950/80 p-5 shadow-[0_0_35px_rgba(16,185,129,0.15)] flex flex-col items-center text-center gap-4" > <div className="w-32 h-32 rounded-full overflow-hidden border-2 border-emerald-500/50 shadow-lg"> <img src={member.photo} alt={member.name} className="w-full h-full object-cover" /> </div> <div className="space-y-1"> <h3 className="text-lg font-semibold">{member.name}</h3> <p className="text-xs uppercase tracking-[0.2em] text-emerald-300/80">{member.role}</p> </div> </div> ))} </section> </main>
<footer className="text-center text-xs text-emerald-300/70 py-6 border-t border-emerald-900 bg-slate-950/95"> © {new Date().getFullYear()} DeepDetection • FaceForensics-inspired workflow ·{' '} <Link className="text-emerald-400 hover:text-emerald-300" href="/analyze"> Start analysis </Link> </footer> </div> );}1234567893 unmodified lines131415161718192021222324252627282911 unmodified lines414243334445464748495051525354555635 unmodified lines929394959697989910010110210327 unmodified lines13113213310813413513613713813914014114214314414514614790 unmodified lines2382392402412422432442452462472482492502512522532542552562572582592602612622632641 unmodified line26626726826921227027127227322 unmodified lines296297298241299300301302import Link from "next/link";import { useEffect, useRef, useState } from "react";import FrameGrid from "../components/FrameGrid";
export default function Analyze() { const MAX_FILE_BYTES = 15 * 1024 * 1024; // 15 MB cap const [videoFile, setVideoFile] = useState(null); const [previewUrl, setPreviewUrl] = useState(""); const [loading, setLoading] = useState(false);3 unmodified lines const [isModalClosing, setIsModalClosing] = useState(false); const fileInputRef = useRef(null);
const isValidSize = (file) => file && file.size <= MAX_FILE_BYTES;
const onFileChange = (e) => { const f = e.target.files?.[0]; if (f && !isValidSize(f)) { setError("Video must be 15 MB or smaller."); setVideoFile(null); if (fileInputRef.current) fileInputRef.current.value = ""; return; } setError(""); setVideoFile(f || null); };
11 unmodified lines e.preventDefault(); e.stopPropagation(); const f = e.dataTransfer.files?.[0]; if (f && f.type.startsWith("video/")) setVideoFile(f); if (f && f.type.startsWith("video/")) { if (!isValidSize(f)) { setError("Video must be 15 MB or smaller."); setVideoFile(null); if (fileInputRef.current) fileInputRef.current.value = ""; return; } setError(""); setVideoFile(f); } };
const onDragOver = (e) => {35 unmodified lines setError("Please select a video file."); return; } if (!isValidSize(videoFile)) { setError("Video must be 15 MB or smaller."); setVideoFile(null); if (fileInputRef.current) fileInputRef.current.value = ""; return; } setLoading(true); try { const formData = new FormData();27 unmodified lines <h1 className="text-lg font-semibold">Deepfake Detection Console</h1> </div> </div> <div className="flex items-center gap-3" /> <nav className="flex items-center gap-4 text-xs md:text-sm font-mono text-emerald-200/80"> <Link className="hover:text-emerald-400 transition" href="/"> Home </Link> <Link className="hover:text-emerald-400 transition" href="/analyze"> Analyze </Link> <Link className="hover:text-emerald-400 transition" href="/about"> About </Link> </nav> </div> </header>
90 unmodified lines <h2 className="text-xl md:text-2xl font-semibold mb-1">Final conclusion</h2> {result ? ( (() => { const predictions = Array.isArray(result.predictions) ? result.predictions : []; const hasAnyFace = predictions.some((pred = {}) => { const flag = pred.has_face ?? pred.hasFace; if (typeof flag === "boolean") return flag; const lbl = (pred.label || "").toLowerCase(); return lbl !== "no face" && lbl !== "no_face"; });
if (!hasAnyFace) { return ( <div className="flex-1 flex flex-col items-center justify-center text-sm md:text-base text-emerald-200/80 space-y-2"> <span className="px-3 py-1 rounded-full bg-slate-900 border border-emerald-800 text-xs md:text-sm font-mono"> No faces detected </span> <p className="max-w-sm text-emerald-300/80"> None of the sampled frames contained a detectable face, so we cannot compute a reliable verdict. </p> </div> ); }
const rawScore = typeof result.final_score === "number" ? result.final_score1 unmodified line const fakeProb = Math.max(0, Math.min(1, rawScore)); const realProb = 1 - fakeProb; const isFake = result.final_label === "fake"; const labelProb = isFake ? fakeProb : realProb; const percent = Math.round(fakeProb * 100); const percent = Math.round(labelProb * 100); const labelText = isFake ? "FAKE" : "REAL"; const primaryColor = isFake ? "#ef4444" : "#22c55e"; // red-500 or emerald-500 const trackColor = "#020617"; // slate-95022 unmodified lines <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. Circle shows how confident the model is in this verdict. </div> <div className="text-emerald-300/70 text-[10px] md:text-xs mt-1"> Always review the individual frames below; treat this as a guide, not absolute proof.12234567891011122 unmodified lines15161718192021222324252627282930313233343536377 unmodified lines454647294849505152535455565758596061333462636465666768406970717268 unmodified lines14114214311514414514614714814915015115215333 unmodified lines187188189155190191192193194195161196197198199200import Link from "next/link";import { useEffect, useState } from "react";import { useEffect, useRef, useState } from "react";
const HERO_FRAMES = ["/1.jpg", "/2.jpg", "/3.jpg", "/4.jpg", "/5.jpg"];
export default function Landing() { const [heroFrameIndex, setHeroFrameIndex] = useState(0); const [howVisible, setHowVisible] = useState(false); const howRef = useRef(null);
useEffect(() => { if (!HERO_FRAMES.length) return;2 unmodified lines }, 3500); return () => clearInterval(id); }, []);
useEffect(() => { if (!howRef.current) return; const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { setHowVisible(true); observer.unobserve(entry.target); } }); }, { threshold: 0.3, rootMargin: "0px 0px -25% 0px" } ); observer.observe(howRef.current); return () => observer.disconnect(); }, []); return ( <div className="min-h-screen flex flex-col bg-slate-950 text-emerald-50 text-sm md:text-base bg-radial-fade animate-fade-in"> <header className="border-b border-emerald-800/60 bg-slate-950/80 backdrop-blur">7 unmodified lines <span className="text-lg font-semibold">Deepfake Detection Console</span> </div> </div> <div className="flex items-center gap-3" /> <nav className="flex items-center gap-4 text-xs md:text-sm font-mono text-emerald-200/80"> <Link className="hover:text-emerald-400 transition" href="/"> Home </Link> <Link className="hover:text-emerald-400 transition" href="/analyze"> Analyze </Link> <Link className="hover:text-emerald-400 transition" href="/about"> About </Link> </nav> </div> </header>
<main className="flex-1 space-y-10 md:space-y-12"> <section className="relative overflow-hidden border-b border-emerald-900/60 animate-fade-in-up"> <main className="flex-1"> <section className="relative overflow-hidden border-b border-emerald-900/60 animate-fade-in-up min-h-[80vh] md:min-h-[90vh] py-20 md:py-28 flex items-center"> <div className="absolute inset-0 pointer-events-none"> <div className="absolute inset-0 opacity-20 bg-[radial-gradient(circle_at_top,_#22c55e33,_transparent_60%)]" /> <div className="absolute inset-0 opacity-[0.07] bg-[linear-gradient(to_right,#10b981_10%,transparent_10%),linear-gradient(to_bottom,#10b981_10%,transparent_10%)] bg-[length:20px_20px]" /> </div>
<div className="relative max-w-7xl mx-auto px-4 py-16 md:py-20 grid md:grid-cols-2 gap-10 items-center"> <div className="relative max-w-7xl mx-auto px-4 grid gap-12 lg:grid-cols-[1.1fr,0.9fr] items-center"> <div className="space-y-5 animate-fade-in-scale"> <p className="text-xs md:text-sm font-mono uppercase tracking-[0.35em] text-emerald-400/80"> Real-time video forensics68 unmodified lines </div> </section>
<section className="max-w-7xl mx-auto px-4 py-12 md:py-16 animate-fade-in-up"> <section ref={howRef} className={`max-w-7xl mx-auto px-4 py-12 md:py-16 transition-all duration-700 ${ howVisible ? "opacity-100 translate-y-0" : "opacity-0 translate-y-10" }`} style={{ visibility: howVisible ? "visible" : "hidden" }} > <div className="max-w-3xl"> <h2 className="text-xl md:text-2xl font-semibold">How it works</h2> </div>33 unmodified lines ].map((step, idx) => ( <div key={step.title} className={`rounded-lg border bg-slate-950/80 p-3 flex flex-col gap-1 ${ className={`rounded-lg border bg-slate-950/80 p-3 flex flex-col gap-1 transition-all duration-500 ${ idx % 3 === 0 ? "border-emerald-700/60" : idx % 3 === 1 ? "border-cyan-600/60" : "border-fuchsia-600/60" }`} } ${howVisible ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4"}`} style={{ transitionDelay: howVisible ? `${idx * 80}ms` : "0ms" }} > <div className="text-[10px] uppercase tracking-wide text-emerald-400/90">{step.title}</div> <div className="font-semibold">{step.heading}</div>app.py+13-6
frontend/components/FrameGrid.jsx+17-10
frontend/pages/about.jsxAdded+89
frontend/pages/analyze.jsx+62-4
frontend/pages/index.jsx+44-8
frontend/public/aqsa.jpgAdded

frontend/public/brian.jpgAdded

frontend/public/jess.jpgAdded
