Skip to content

Harsh2o/DetectAi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” DetectAi

The Human Standard

Enterprise-grade, multi-modal AI content detection engine.
Catch ChatGPT essays, Midjourney images, Sora deepfakes, and ElevenLabs voice clones β€” all in one platform.

Live Demo API Docs License
Python React


DetectAi Demo GIF


🎯 The Problem

AI-generated content is everywhere β€” and existing detection tools are fragmented. Teachers juggle separate tools for text, images, and video. Students get falsely flagged. Deepfakes go undetected. There is no single platform that handles all modalities.

DetectAi solves this with a unified, multi-modal detection engine that analyzes text, images, video, and audio through a single API and dashboard.


πŸ—οΈ Architecture

DetectAi uses a Branch-and-Fuse architecture. Each media type is processed through an independent pipeline composed of specialized analysis branches. Branch outputs are fused into a single, calibrated confidence score.

graph TB
    subgraph Client["πŸ–₯️ Frontend β€” React + Vite"]
        UI[Landing Page / Dashboard]
        Auth[Clerk Auth]
        SEO[Programmatic SEO Engine]
    end

    subgraph Gateway["⚑ FastAPI Gateway β€” Azure App Service"]
        direction TB
        TextRouter["/detect/text"]
        ImageRouter["/detect/image"]
        VideoRouter["/detect/video"]
        AudioRouter["/detect/audio"]
    end

    subgraph TextEngine["πŸ“ Text Engine β€” 5 Branches"]
        T1[RoBERTa Transformer]
        T2[GPT-2 Perplexity]
        T3[Stylometry Analysis]
        T4[Sentence-BERT Embeddings]
        T5[Humanization Detector]
        TF[LightGBM Meta-Classifier]
    end

    subgraph ImageEngine["πŸ–ΌοΈ Image Engine β€” 6 Branches"]
        I1[ViT Deep Classifier]
        I2[Error Level Analysis]
        I3[FFT Spectral Analysis]
        I4[EXIF Metadata Inspection]
        I5[PRNU Sensor Noise]
        I6[Statistical Heuristics]
        IF[Weighted Confidence Fusion]
    end

    subgraph VideoEngine["🎬 Video Engine β€” 9 Branches"]
        V1[ViT + DinoV2 Ensemble]
        V2[Temporal Consistency]
        V3[RAFT Optical Flow]
        V4[MiDaS Depth Physics]
        V5[CLIP Semantic Drift]
        V6[FFT Spectral Score]
        V7[PRNU Sensor Noise]
        V8[Audio-Visual Sync]
        V9[Codec Heuristics]
        VF[9-Branch Weighted Fusion]
    end

    subgraph AudioEngine["πŸŽ™οΈ Audio Engine"]
        A1[MFCC + Spectral Features]
        A2[Calibrated Random Forest]
    end

    UI -->|HTTPS| Gateway
    TextRouter --> TextEngine
    ImageRouter --> ImageEngine
    VideoRouter --> VideoEngine
    AudioRouter --> AudioEngine

    T1 & T2 & T3 & T4 & T5 --> TF
    I1 & I2 & I3 & I4 & I5 & I6 --> IF
    V1 & V2 & V3 & V4 & V5 & V6 & V7 & V8 & V9 --> VF
    A1 --> A2
Loading

πŸ“– Deep dive: See docs/architecture.md for full technical details on each branch.


✨ Features

Feature Description
πŸ”€ Text Detection 5-branch ensemble (RoBERTa, perplexity, stylometry, embeddings, humanization) with LightGBM meta-classifier and per-sentence explainability
πŸ–ΌοΈ Image Detection 6-branch fusion (ViT, ELA, FFT, EXIF, PRNU, heuristics) with perceptual hash caching
🎬 Video Detection 9-branch fusion (ViT, DinoV2, RAFT optical flow, MiDaS depth, CLIP semantic drift, temporal analysis)
πŸŽ™οΈ Audio Detection Spectral feature extraction + calibrated Random Forest for voice clone detection
πŸ“Š Dashboard Real-time scan results, history tracking, analytics charts
πŸ” Authentication Clerk-powered OAuth with SSO support
πŸŒ— Dark Mode Full dark/light theme support with smooth transitions
πŸ” SEO Engine Programmatic long-tail SEO with Schema.org structured data and auto-generated sitemap

πŸ› οΈ Tech Stack

Tech Stack


Layer Technology
Frontend React 19, Vite, Framer Motion, Recharts
Auth Clerk
Backend FastAPI, Python 3.11, Uvicorn
ML Models PyTorch, HuggingFace Transformers (ViT, RoBERTa, DinoV2, RAFT, MiDaS, GPT-2)
Ensemble LightGBM, scikit-learn (isotonic calibration)
Task Queue Celery + Redis
Database SQLite
Hosting Azure App Service (B3), Vercel
CI/CD GitHub Actions β†’ Azure auto-deploy
Analytics Vercel Web Analytics

πŸ“ Project Structure

Click to expand directory tree
detectai/
β”œβ”€β”€ backend/                    # FastAPI application
β”‚   β”œβ”€β”€ main.py                 # App entrypoint & router registration
β”‚   β”œβ”€β”€ text/                   # Text detection module
β”‚   β”‚   β”œβ”€β”€ router.py           # /detect/text endpoint
β”‚   β”‚   β”œβ”€β”€ engines/            # 5 detection branches
β”‚   β”‚   β”‚   β”œβ”€β”€ transformer.py  #   └─ RoBERTa classifier
β”‚   β”‚   β”‚   β”œβ”€β”€ perplexity.py   #   └─ GPT-2 perplexity scorer
β”‚   β”‚   β”‚   β”œβ”€β”€ stylometry.py   #   └─ Statistical text analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ embeddings.py   #   └─ Sentence-BERT similarity
β”‚   β”‚   β”‚   └── humanization.py #   └─ Paraphrase detector
β”‚   β”‚   β”œβ”€β”€ ensemble/           # Meta-classifier & calibration
β”‚   β”‚   β”œβ”€β”€ explainability/     # Per-sentence attribution
β”‚   β”‚   β”œβ”€β”€ preprocessors/      # Chunking & language detection
β”‚   β”‚   └── models/             # Serialized model artifacts
β”‚   β”œβ”€β”€ image/                  # Image detection module
β”‚   β”‚   β”œβ”€β”€ router.py           # /detect/image endpoint
β”‚   β”‚   β”œβ”€β”€ fusion.py           # Weighted branch fusion
β”‚   β”‚   β”œβ”€β”€ tasks.py            # Celery async tasks
β”‚   β”‚   └── branches/           # 6 detection branches
β”‚   β”‚       β”œβ”€β”€ deep_classifier.py  # ViT classifier
β”‚   β”‚       β”œβ”€β”€ ela.py              # Error Level Analysis
β”‚   β”‚       β”œβ”€β”€ fft_cnn.py          # FFT spectral analysis
β”‚   β”‚       β”œβ”€β”€ metadata.py         # EXIF inspection
β”‚   β”‚       β”œβ”€β”€ prnu_residual.py    # Sensor noise analysis
β”‚   β”‚       └── advanced_heuristics.py
β”‚   β”œβ”€β”€ video/                  # Video detection module
β”‚   β”‚   β”œβ”€β”€ router.py           # /detect/video endpoint
β”‚   β”‚   └── branches/           # 9 detection branches
β”‚   β”‚       β”œβ”€β”€ vit_ensemble.py     # ViT + DinoV2
β”‚   β”‚       β”œβ”€β”€ temporal_consistency.py
β”‚   β”‚       β”œβ”€β”€ motion_physics.py   # RAFT optical flow
β”‚   β”‚       β”œβ”€β”€ depth_physics.py    # MiDaS depth estimation
β”‚   β”‚       β”œβ”€β”€ semantic_drift.py   # CLIP embeddings
β”‚   β”‚       β”œβ”€β”€ fft_score.py
β”‚   β”‚       β”œβ”€β”€ prnu_score.py
β”‚   β”‚       β”œβ”€β”€ audio_physics.py
β”‚   β”‚       └── advanced_heuristics.py
β”‚   β”œβ”€β”€ audio/                  # Audio detection module
β”‚   β”‚   β”œβ”€β”€ router.py           # /detect/audio endpoint
β”‚   β”‚   └── tasks.py            # Feature extraction & classification
β”‚   β”œβ”€β”€ database.py             # SQLite connection manager
β”‚   β”œβ”€β”€ history.py              # Scan history CRUD
β”‚   β”œβ”€β”€ models.py               # Pydantic schemas
β”‚   β”œβ”€β”€ celery_app.py           # Task queue config
β”‚   β”œβ”€β”€ Dockerfile              # Container build
β”‚   └── requirements.txt        # Python dependencies
β”œβ”€β”€ frontend/                   # React SPA
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx             # Router & providers
β”‚   β”‚   β”œβ”€β”€ pages/              # Page components
β”‚   β”‚   β”œβ”€β”€ components/         # Shared UI components
β”‚   β”‚   β”œβ”€β”€ config/seoConfig.js # Programmatic SEO configuration
β”‚   β”‚   β”œβ”€β”€ context/            # Theme provider
β”‚   β”‚   └── lib/                # Utility functions
β”‚   β”œβ”€β”€ public/                 # Static assets, sitemap, robots.txt
β”‚   β”œβ”€β”€ index.html              # HTML entry point
β”‚   └── vite.config.js          # Vite build configuration
β”œβ”€β”€ docs/                       # Technical documentation
β”‚   β”œβ”€β”€ architecture.md         # System architecture deep-dive
β”‚   β”œβ”€β”€ api_reference.md        # API endpoint reference
β”‚   └── text_engine_architecture.md
β”œβ”€β”€ .github/workflows/          # CI/CD pipelines
β”‚   └── azure-deploy.yml        # Auto-deploy to Azure on push
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ LICENSE                     # All Rights Reserved
└── README.md                   # ← You are here

πŸš€ Getting Started

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Git

1. Clone the Repository

git clone https://github.com/Harsh2o/detectai.git
cd detectai

2. Backend Setup

cd backend
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env            # Add your HuggingFace token
uvicorn main:app --reload --host 0.0.0.0 --port 8000

The API will be live at http://localhost:8000/docs

3. Frontend Setup

cd frontend
npm install
cp .env.example .env.local      # Configure API URL & Clerk keys
npm run dev

The app will be live at http://localhost:5173


🌐 Deployment

Backend β†’ Azure App Service

The backend auto-deploys via GitHub Actions. Every push to main triggers the workflow in .github/workflows/azure-deploy.yml.

# Deploys to: https://detectai-api-xxxxx.azurewebsites.net

Frontend β†’ Vercel

The frontend auto-deploys via Vercel's GitHub integration. Connect your repo in the Vercel dashboard and set the following environment variables:

Variable Value
VITE_API_URL Your Azure backend URL
VITE_CLERK_PUBLISHABLE_KEY Your Clerk publishable key

πŸ“– Documentation

Document Description
Architecture Full system architecture, engine details, and infrastructure
API Reference Complete REST API endpoint documentation
Text Engine Deep-dive into the text detection pipeline
Contributing Development setup and contribution guidelines

πŸ“„ License

This project is licensed under All Rights Reserved β€” see the LICENSE file for details. You may view this code for educational purposes, but copying, deploying, or modifying it is strictly prohibited.


Built with ❀️ by Harsh Gupta

Live Demo Β· API Docs Β· Report Bug Β· Request Feature

About

Enterprise grade, multi modal AI content detector. Catch AI generated text, deepfake videos, images, and voice clones. Built with React, FastAPI, Azure, and ensemble ML models.

Topics

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors