An AI-powered, real-time fraud detection system tailored for Unified Payments Interface (UPI) transactions. The system employs a hybrid detection engine combining Machine Learning, Anomaly Detection, and domain-specific Rule-Based Logic to evaluate transaction risk accurately. It also includes an integrated Google Gemini AI chatbot to explain fraud verdicts and provide safety recommendations.
- Machine Learning (Random Forest): Predicts fraud probability based on historical patterns.
- Anomaly Detection (Isolation Forest): Flags unusual behavioral deviations.
- Rule-Based Logic: Evaluates specific UPI risks (e.g., impossible travel, rapid transactions, high amounts).
Real-time visualization of transaction statistics, detection rates, and feature importance charts.
Allows users to simulate normal, suspicious, and fraudulent transactions to observe the system's real-time response.
Powered by Google Gemini, the assistant provides contextual explanations of fraud flags, security tips, and system methodologies.
Seamless integration with Supabase for logging and querying past transactions.
/ml # Core Python backend and machine learning models
/models # Pre-trained ML models and scalers
/frontend # Frontend application (HTML, CSS, JS)
api.py # Unified Flask server
predict.py # Hybrid fraud detection engine- Python 3.8+
- Supabase account
- Google Gemini API Key
cd mlInstall dependencies:
pip install -r requirements.txtCreate a .env file inside the ml folder:
PORT=5000
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_key
GEMINI_API_KEY=your_gemini_api_keypython api.pyOpen:
http://localhost:5000POST /api/predict→ Fraud detectionPOST /api/chat→ Gemini chatbotGET/POST /api/transactions→ Transaction historyGET /api/transactions/stats→ Dashboard statistics
This project is developed for educational and demonstration purposes only.