How shalvirajpura2/letsverify works
1. Overall shape
- This repo is a two-tier application: a FastAPI inference backend and a React/Vite frontend.
- The core product boundary is clear: the frontend only handles user interaction and upload flow, while the backend owns all image-forensics logic and verdict generation.
2. Backend entrypoint and API boundary
- backend/api/main.py is the server entrypoint.
- It exposes at least two HTTP endpoints: POST /detect for image analysis and GET /health for liveness checks.
- Input is a multipart/form-data file upload, and the response is a structured verdict payload containing the final class, confidence, individual detector signals, and human-readable explanation.
3. Inference orchestration layer
- backend/pipeline/inference_pipeline.py is the backend’s coordination layer.
- Its job is to run detectors, collect their outputs, and synthesize a single verdict with confidence scoring.
- The README indicates an async parallel runner with adaptive weighting, so the architectural pattern is “fan out to signal detectors, then aggregate.”
4. Detector subsystem
- backend/detectors/ is the main analytical subsystem and is organized by signal type.
- The README highlights four core detectors: AI model classification, metadata/EXIF, frequency/FFT, and noise analysis.
- The tree shows additional forensic modules such as c2pa, clip, color, edge, ela, face, jpeg, lighting, texture, and watermark, suggesting the system is designed as a broader multi-signal detector framework, even if only a subset is primary in the current product story.
5. How the backend produces a verdict
- The backend does not emit a simple binary answer; it produces a 7-class confidence verdict ranging from “Real Photograph” to “AI Generated.”
- Each detector contributes a numeric score and short explanation, which are combined into an overall confidence and a consensus/conflict indicator.
- This makes the backend a fusion system rather than a single-model classifier.
6. Primary data flow
- The end-to-end path is: browser upload → frontend API call → FastAPI /detect → image decoding and detector execution → aggregation pipeline → JSON response → result display.
- The response schema is designed for both machine use and UX clarity: final label, confidence percentage, per-signal explanations, and the original filename.
7. Frontend composition
- The frontend is a Vite-built React app in frontend/src/.
- App.jsx is the orchestration component, with UI pieces split into UploadZone, ResultPanel, BatchPanel, and Header.
- The UI is centered around a single-image upload flow, with an additional batch-oriented panel in the component structure for broader usage or future extension.
8. Client-to-backend coupling
- The frontend is configured via VITE_API_URL, which means the backend URL is injected at build/runtime rather than hardcoded.
- Backend CORS is controlled by CORS_ORIGINS, so cross-origin access is an explicit deployment concern.
- This keeps the frontend and backend independently deployable while still connected through a small API surface.
9. Deployment topology
- docker-compose.yml is the local integration boundary that runs both services together.
- The backend has its own Dockerfile and Python dependency set; the frontend has a separate Dockerfile and Node/Vite toolchain.
- The README also documents standalone deployment targets for the frontend and backend, reinforcing that the system is split into independently hosted services.
10. Operational/environment concerns
- backend/.env.example includes runtime limits and network settings such as port, host, max file size, and allowed origins.
- That implies the backend is responsible for request-size enforcement and safe exposure in production.
- The architecture is therefore not just compute-oriented; it also includes basic service hardening around upload handling and cross-origin access.
11. Technology boundaries that matter
- Backend analysis uses Python ML/image libraries: FastAPI for transport, plus PyTorch/Transformers, Pillow, NumPy, and SciPy for inference and signal processing.
- The frontend uses React 18 and Vite, which favors a fast static client that communicates only with the API.
- Docker is the main packaging boundary for local development and deployment portability.
12. What to draw in an architecture diagram
- Draw two major boxes: Frontend UI and Backend Inference Service.
- Inside the backend, show three layers: API layer, pipeline/aggregation layer, and detector modules.
- Show the detector fan-out as parallel signals feeding into an aggregator, which emits a single verdict response back to the UI.
- Include Docker Compose as the local runtime that connects the two services, and external deployment endpoints as optional production targets.
Main entry points: inference_pipeline.py Inference Pipeline · App.jsx App · main.py API Main · docker-compose.yml Compose
Components 21
Frontend UI
React/Vite client for upload and verdict display
- App · Top-level UI orchestration and API wiring
frontend/src/App.jsx - Upload Zone · Single-image upload and submission entry point
frontend/src/components/UploadZone.jsx - Result Panel · Displays final verdict, confidence, and explanations
frontend/src/components/ResultPanel.jsx - Batch Panel · Secondary panel for multi-item or future batch workflows
frontend/src/components/BatchPanel.jsx - Header · Branding and page-level framing
frontend/src/components/Header.jsx - Entry · Mounts the Vite React application
frontend/src/main.jsx
Backend Inference
FastAPI service and image-forensics pipeline
- API Main · Server entrypoint exposing detect and health endpoints
backend/api/main.py - Inference Pipeline · Coordinates detectors and fuses their outputs into one verdict
backend/pipeline/inference_pipeline.py - AI Detector · Model-based classification signal
backend/detectors/ai_detector.py - Metadata · EXIF and file metadata analysis
backend/detectors/metadata_detector.py - Frequency · FFT and frequency-domain analysis
backend/detectors/frequency_detector.py - Noise · Noise-consistency analysis
backend/detectors/noise_detector.py - C2PA · Content provenance and authenticity checks
backend/detectors/c2pa_detector.py - JPEG · Compression artifact analysis
backend/detectors/jpeg_detector.py - ELA · Error-level analysis signal
backend/detectors/ela_detector.py - Texture · Texture-consistency analysis
backend/detectors/texture_detector.py - Face · Face-region forensic signal
backend/detectors/face_detector.py - Other Signals · Additional forensic detectors such as clip, color, edge, lighting, and watermark
backend/detectors/clip_detector.py
Runtime
Local container orchestration and deployment packaging
- Compose · Runs frontend and backend together for local integration
docker-compose.yml - Backend Env · Host, port, file-size, and CORS settings
backend/.env.example - Frontend Env · Build-time API endpoint configuration
frontend/.env.example
Connections 22
- Entry → App: mounts · Bootstraps the React app
- App → Header: renders · Page framing
- App → Upload Zone: uses · Collects image input
- App → Result Panel: uses · Shows verdict output
- App → Batch Panel: uses · Secondary batch-oriented UI
- Upload Zone → API Main: POST /detect · Sends multipart image upload
- App → Frontend Env: reads · Uses API base URL at build/runtime
- API Main → Inference Pipeline: calls · Delegates analysis to the inference pipeline
- API Main → Backend Env: reads · Uses runtime limits and CORS settings
- Inference Pipeline → AI Detector: fans out · Runs model classification in parallel
- Inference Pipeline → Metadata: fans out · Runs metadata analysis in parallel
- Inference Pipeline → Frequency: fans out · Runs frequency analysis in parallel
- Inference Pipeline → Noise: fans out · Runs noise analysis in parallel
- Inference Pipeline → C2PA: fans out · Runs provenance checks when available
- Inference Pipeline → JPEG: fans out · Runs compression analysis
- Inference Pipeline → ELA: fans out · Runs ELA signal extraction
- Inference Pipeline → Texture: fans out · Runs texture analysis
- Inference Pipeline → Face: fans out · Runs face-region signal analysis
- Inference Pipeline → Other Signals: fans out · Collects additional forensic signals
- Inference Pipeline → API Main: returns verdict · Aggregates scores and explanations into JSON response
- Compose → Entry: starts · Brings up the client service
- Compose → API Main: starts · Brings up the inference service