How nguyentrongnguyen04/deepfake-detection works
Project type and purpose
• DeepGuard is primarily a single-page front-end application that integrates with an external AI/ML service (Gradio API hosting Xception deepfake models).
• Its purpose is to let end users upload images, select a detection model, submit to the AI back end for analysis, and display deepfake probability, confidence scores, and history.
File structure
• Top-level “project” directory contains:
• public/ — static assets (favicon, index.html shell)
• src/ — the entire React application
– components/ — reusable UI components (Header, Footer, ImageUploader, ResultsDisplay, etc.)
– sections/ — page sections (Hero, Detection, About, HowItWorks)
– contexts/ — React Context for theming
– utils/ — helper functions (mock detector, localStorage wrapper, API client)
– types/ — shared TypeScript interfaces
– App.tsx, main.tsx — application bootstrap
• Configuration files: vite.config.ts, tsconfig.json, tailwind.config.js, eslint.config.js
README for additional insights
• Confirms front-end tech stack, Gradio API integration, and feature set (model selection, image upload, history tracking, dark mode).
a. Main components
• User’s Web Browser
• Front-end Application
– UI Layer: React components, Tailwind CSS, Framer Motion
– State & Context: ThemeContext, component state for model, image, results
– Utility Layer: API client (utils/api.ts), storage helper (utils/storage.ts)
• External AI Service
– Gradio API endpoint wrapping the Xception model
• Local Persistence
– browser localStorage (analysis history)
b. Relationships and interactions
1. User interacts with UI components (ModelSelector, ImageUploader)
2. On submit, front-end sends HTTP request via API client to Gradio API
3. Gradio API processes the image using Xception and returns JSON results
4. Front-end receives results, updates state, renders ResultsDisplay and MetricsDisplay
5. Front-end writes record to localStorage (history) and displays via HistoryPanel
c. Architectural patterns and design principles
• Component-based UI with clear separation of concerns
• Context API for cross-cutting concerns (theme)
• Utility modules for side effects (network calls, storage)
• Single source of truth in top-level App component
d. Key technologies
• React + TypeScript for type-safe UI
• Vite for development/build
• Tailwind CSS for styling, Framer Motion for animation
• Gradio API (external) for deep learning inference
• localStorage for client-side persistence