ofc01/janrakshak-api
0
š”ļø JanRakshak Vision ā Backend API (v7)
AI Deepfake Detection Backend | JanRakshak Vision | Tradition Hacks 2026 Team: Anonymous Group | Leader: Kushal Soni
  
š Live Deployment
š” API Endpoints
GET /
Health check and basic info.
{
"status": "JanRakshak Vision API ā
",
"version": "1.0.0",
"team": "Anonymous Group",
"leader": "Kushal Soni",
"competition": "Tradition Hacks 2026",
"limits": {
"image_max": "50MB",
"video_max": "100MB",
"rate_image": "10 requests/minute per IP",
"rate_video": "5 requests/minute per IP"
}
}POST /analyze/image
Upload any image (JPG, PNG, WEBP, GIF, BMP ā max 50MB)
Response:
{
"verdict": "FAKE",
"confidence": 88,
"fake_score": 0.8842,
"real_score": 0.1158,
"explanation": {
"en": "This image shows 88% signs of AI generation...",
"hi": "ą¤ą¤ø ą¤¤ą¤øą„ą¤µą„र ą¤®ą„ą¤ 88% AI ą¤Øą¤æą¤°ą„ą¤®ą¤¾ą¤£ ą¤ą„ ą¤øą¤ą¤ą„त ą¤¹ą„ą¤...",
"bn": "ą¦ą¦ ą¦ą¦¬ą¦æą¦¤ą§ 88% AI ą¦¤ą§ą¦°ą¦æą¦° ą¦²ą¦ą§ą¦·ą¦£ ą¦°ą¦Æą¦¼ą§ą¦ą§..."
},
"file_type": "image",
"file_name": "photo.jpg",
"frames_analyzed": null,
"model_votes": [
{ "name": "detector_v2", "fake_score": 0.95, "verdict": "FAKE", "confidence": 95 },
{ "name": "sdxl", "fake_score": 0.82, "verdict": "FAKE", "confidence": 82 },
{ "name": "general", "fake_score": 0.85, "verdict": "FAKE", "confidence": 85 }
]
}POST /analyze/video
Upload any video (MP4, AVI, MOV, MKV ā max 100MB)
Same response format + frames_analyzed count + frame_breakdown array (per-frame verdicts), plus avg_fake_score and real_score averaged across frames.
š¤ The "3-Brain" AI Ensemble (v7)
Three models run in parallel, combined with a custom Smart Heuristic Engine:
Smart Heuristic Logic:
- High-Confidence Boost: If any single model >85% FAKE, final score is boosted.
- Composite Floor: If Brain 3 (Composites) ā„70%, final verdict floored to
SUSPICIOUS. - Screenshot Filter: Detects UI screenshots (low color count + low variance) and dampens the fake score by 60% to prevent false positives.
- Thresholds:
FAKE ā„ 50%,SUSPICIOUS ā„ 30%,REAL < 30%
šļø Architecture
React Frontend (Vercel)
ā
ā HTTPS POST /analyze/image
ā¼
FastAPI Backend (HuggingFace Space ā Docker)
ā
āāā Brain 1: haywoodsloan (35%)
āāā Brain 2: Organika (35%)
āāā Brain 3: umm-maybe (30%)
ā
āāā Smart Heuristic Engine (Python)
ā
āāā FAKE / SUSPICIOUS / REALš Local Development
# Install dependencies
pip install -r requirements.txt
# Run locally
uvicorn app:app --reload --port 8000
# Test API
curl -X POST "http://localhost:8000/analyze/image" \
-F "file=@test_image.jpg"š Project Structure
janrakshak-backend/
āāā app.py # FastAPI routes, Rate Limiting (slowapi), CORS, lifespan
āāā models.py # 3-model ensemble inference & heuristic engine
āāā utils.py # PIL helpers, video frame extraction, memory mgmt
āāā requirements.txt # Python dependencies
āāā Dockerfile # HuggingFace Space Docker configš Privacy & Zero-Storage
- Zero storage ā files analyzed in RAM, never written to disk (except temp video files, instantly deleted via
os.unlink). - Memory Management ā explicitly calls
delandgc.collect()after every inference to free memory instantly. - No logging ā image contents, user IPs, and hashes are never stored.
<div align="center"> Built for Tradition Hacks 2026 | Leader: Kushal Soni | Anonymous Group </div>
