--- title: AI vs Real Image Detection emoji: 🔍 colorFrom: blue colorTo: purple sdk: docker app_port: 7860 pinned: false license: mit short_description: FastAPI ensemble AI image detection service --- # 🔍 AI vs Real Image Detection A FastAPI-based web service that detects whether images are AI-generated or real using ensemble model prediction. ## Features - **FastAPI Backend**: High-performance async API - **Ensemble Detection**: Uses multiple AI detection models for higher accuracy - **CPU Optimized**: Runs efficiently on Hugging Face Spaces free tier - **REST API**: Simple POST endpoint for image analysis ## API Endpoints - `GET /` - Root endpoint with service information - `GET /health` - Health check endpoint - `POST /analyze` - Upload image for AI vs Real detection - `GET /docs` - Interactive Swagger API documentation ## Usage 1. **Health Check**: `GET /health` 2. **Analyze Image**: `POST /analyze` with image file in form data 3. **API Docs**: Visit `/docs` for interactive documentation ## Response Format ```json { "real_prob": 0.85, "ai_prob": 0.15, "analysis_time": 2.3, "device": "CPU" } ``` ## Models Used - dima806/deepfake_vs_real_image_detection - umm-maybe/AI-image-detector - Organika/sdxl-detector Built with FastAPI, PyTorch, and Transformers. Optimized for CPU deployment.