FastAPI-based anomaly detection system for video frames, running completely locally with no cloud dependencies. Originally developed on Azure Databricks, now fully independent for cost-free operation.
🎬 Watch Demo Video (7.5MB)
Live demonstration of the Streamlit web interface with drag & drop image upload and real-time anomaly detection results
Note: Video is hosted in GitHub Releases
🔗 View Live Results (GitHub Pages)
📓 Interactive Testing Notebook - Run this notebook to see live predictions with HTML visualization
Real-time anomaly detection results showing normal frames (green border) and anomalous frames (red border) with confidence scores.
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Download model from Databricks to local storage
# This creates models/model/ directory with the MLflow model
python download_model.py# Use local model (Databricks-independent)
python api_local.pyNote:
api.pyis no longer available as the Azure Databricks workspace has been deleted. Onlyapi_local.pyworks with the downloaded local model.
python client.pyOpen notebook/07_deployment.ipynb for interactive testing with HTML visualization.
# Install Streamlit (if not already installed)
pip install streamlit
# Start the local API server first
python api_local.py
# In another terminal, run the web interface
streamlit run web_interface.pyThen open your browser to http://localhost:8501 and upload your own images for real-time predictions!
anomaly_detection/
├── api.py # FastAPI server
├── client.py # API client for testing
├── web_interface.py # Streamlit web interface for image upload
├── frames/ # Sample images
├── notebook/ # Jupyter notebooks
│ └── 07_deployment.ipynb # Interactive testing & visualization
└── requirements.txt # Dependencies
- 🏠 Fully Local: No cloud dependencies or costs
- 📤 Base64 Image Processing: Handles multiple images in batch
- ⚡ Real-time Predictions: Fast inference with CPU optimization
- 🎨 Visual Results: Color-coded prediction display
- 🌐 Web Interface: Drag & drop image upload with Streamlit
- 🛡️ Error Handling: Comprehensive logging and fallback mechanisms
- 💰 Cost-Free: Zero ongoing operational costs
GET /: Health checkPOST /predict: Batch image prediction
- Framework: Transformers pipeline via MLflow
- Input: Base64-encoded images
- Output: Classification scores (normal/anomaly)
- Deployment: Local FastAPI (Databricks alternative)
