Spaces:
Running
Running
metadata
title: DetectMeBotBackend
emoji: π€
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
Deepfake Detection Service Backend
Prerequisites
- Python 3.8+
- pip or conda
Installation
Navigate to the backend directory:
cd backendCreate a virtual environment (recommended):
# Using venv python -m venv venv # Activate virtual environment # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activateInstall dependencies:
pip install -r requirements.txtRun the server:
python main.py
The server will start on http://127.0.0.1:8000
π API Documentation
Once the server is running, interactive API documentation is available at:
- Swagger UI:
http://127.0.0.1:8000/docs - ReDoc:
http://127.0.0.1:8000/redoc
Analyze File
POST /analyze
Content-Type: application/json
{
"file_url": "https://example.com/video.mp4",
"model": "mock"
}
Request Parameters:
file_url(required): URL of the file to analyzemodel(optional): Detector model to use. Defaults to configured model
Response (200 OK):
{
"is_deepfake": true,
"confidence": 0.847,
"analysis_time": 1.234,
"used_model": "mock"
}
Error Responses:
400 Bad Request: Invalid URL, file too large, or unsupported model408 Request Timeout: File download timed out500 Internal Server Error: Server error during analysis
Using curl:
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"file_url": "https://example.com/video.mp4"}'
The API provides comprehensive error handling:
# Invalid URL
{
"error": "Invalid URL format",
"status_code": 400,
"details": null
}
# File too large
{
"error": "File size exceeds maximum allowed size of 104857600 bytes",
"status_code": 400,
"details": null
}
# Download timeout
{
"error": "File download timed out",
"status_code": 408,
"details": null
}
# Unsupported model
{
"error": "Detector model 'invalid' is not supported. Available models: mock",
"status_code": 400,
"details": null
}