Skip to content

About

AI-powered real-time UPI fraud detection system using Machine Learning, Anomaly Detection, and Rule-Based Logic. Detects suspicious transactions, generates risk scores, sends instant alerts, and integrates a Google Gemini AI chatbot to explain fraud verdicts and provide security recommendations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

UPI Fraud Detection System

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.

Features

Hybrid Fraud Engine

  • 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).

Interactive Dashboard

Real-time visualization of transaction statistics, detection rates, and feature importance charts.

Advanced Simulator

Allows users to simulate normal, suspicious, and fraudulent transactions to observe the system's real-time response.

AI Chatbot

Powered by Google Gemini, the assistant provides contextual explanations of fraud flags, security tips, and system methodologies.

Transaction History

Seamless integration with Supabase for logging and querying past transactions.


Project Structure

/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

Setup & Installation

Prerequisites

  • Python 3.8+
  • Supabase account
  • Google Gemini API Key

1. Backend Setup

cd ml

Install dependencies:

pip install -r requirements.txt

2. Environment Configuration

Create 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_key

3. Run the Application

python api.py

Open:

http://localhost:5000

APIs

  • POST /api/predict → Fraud detection
  • POST /api/chat → Gemini chatbot
  • GET/POST /api/transactions → Transaction history
  • GET /api/transactions/stats → Dashboard statistics

Disclaimer

This project is developed for educational and demonstration purposes only.

About

AI-powered real-time UPI fraud detection system using Machine Learning, Anomaly Detection, and Rule-Based Logic. Detects suspicious transactions, generates risk scores, sends instant alerts, and integrates a Google Gemini AI chatbot to explain fraud verdicts and provide security recommendations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages