🚨 A machine learning web application that detects fraudulent credit card transactions in real time. Built with Python and a trained classification model, this project helps identify suspicious activity with high accuracy.
💡 Credit card fraud is a major financial threat. This project uses a pre-trained ML model (fraud_model.pkl) and a data scaler (scaler.pkl) to predict whether a given transaction is fraudulent or legitimate based on transaction features.
🖥️ The application includes an HTML-based frontend to interact with the model through a simple and clean interface.
- 🔍 Real-time fraud prediction on transaction data
- 🤖 Pre-trained machine learning model (scikit-learn)
- 📊 Trained on real-world credit card transaction dataset
- 🌐 Simple HTML frontend interface
- ⚡ Fast and lightweight — no heavy dependencies
- 🛡️ Helps protect users from financial fraud
💳 creditcardfraud/
├── 📁 crditcardfraud/ # Core application (Python + HTML)
├── 🤖 fraud_model.pkl # Trained ML classification model
├── ⚖️ scaler.pkl # Feature scaler for preprocessing
├── 📄 transactions.csv # Sample transaction data
├── 🗜️ creditcard.csv.zip # Full dataset (zipped)
└── 📝 README.md
Make sure you have the following installed:
- 🐍 Python 3.8+
- 📦 pip
- 📥 Clone the repository
git clone https://github.com/tanishcode-12/creditcardfraud.git
cd creditcardfraud- 📦 Install dependencies
pip install -r requirements.txt
⚠️ If there's norequirements.txt, install manually:
pip install flask scikit-learn pandas numpy- 🗜️ Extract the dataset
unzip creditcard.csv.zip -d ./📂 This will extract
creditcard.csvinto the project folder. Make sure it's in the root directory before running the app.
▶️ Run the application
python app.py- 🌐 Open in your browser
http://127.0.0.1:5000
- 🟢 Launch the app using the steps above.
- ✍️ Enter the transaction details in the input form.
- 🔮 Click Predict to find out if the transaction is Fraudulent or Legitimate.
- ✅ The model will return a result instantly based on the trained data.
📁 You can also test using the sample data in
transactions.csv.
🙌 Contributions are welcome! Here's how you can help:
- 🍴 Fork the repository
- 🌿 Create a new branch (
git checkout -b feature/your-feature) - 💾 Make your changes and commit (
git commit -m 'Add your feature') - 📤 Push to the branch (
git push origin feature/your-feature) - 🔁 Open a Pull Request
✅ Please make sure your code is clean and well-commented.
Tanish — @tanishcode-12
⭐ If you found this project helpful, consider giving it a star on GitHub!