|
|
--- |
|
|
title: E-Commerce Fraud Detection |
|
|
emoji: π‘οΈ |
|
|
colorFrom: blue |
|
|
colorTo: purple |
|
|
sdk: streamlit |
|
|
sdk_version: 1.28.1 |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
license: mit |
|
|
tags: |
|
|
- fraud-detection |
|
|
- machine-learning |
|
|
- streamlit |
|
|
- e-commerce |
|
|
- security |
|
|
datasets: |
|
|
- fraud-detection-dataset |
|
|
--- |
|
|
|
|
|
# π‘οΈ E-Commerce Fraud Detection System |
|
|
|
|
|
A Streamlit app for real-time e-commerce fraud detection using machine learning and explainable AI. |
|
|
|
|
|
## π Features |
|
|
- Real-time fraud risk assessment |
|
|
- Explainable AI (feature impact) |
|
|
- Interactive analytics dashboard |
|
|
- Modular, production-ready code |
|
|
|
|
|
## ποΈ Project Structure |
|
|
``` |
|
|
app.py |
|
|
pages/ |
|
|
home.py |
|
|
fraud_detection.py |
|
|
model_insights.py |
|
|
analytics_dashboard.py |
|
|
utils/ |
|
|
model_utils.py |
|
|
preprocessing.py |
|
|
visualization.py |
|
|
requirements.txt |
|
|
lightgbm_model.pkl |
|
|
customer_loc.pkl |
|
|
``` |
|
|
|
|
|
## βοΈ Configuration |
|
|
|
|
|
### Hugging Face Space Configuration |
|
|
For optimal deployment on Hugging Face Spaces, ensure your repository includes: |
|
|
|
|
|
#### Space Metadata (README.md) |
|
|
```yaml |
|
|
--- |
|
|
title: E-Commerce Fraud Detection |
|
|
emoji: π‘οΈ |
|
|
colorFrom: blue |
|
|
colorTo: purple |
|
|
sdk: streamlit |
|
|
sdk_version: 1.28.1 |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
license: mit |
|
|
--- |
|
|
``` |
|
|
|
|
|
#### Space Configuration (README.md) |
|
|
Add this section to your README for better Space discovery: |
|
|
```yaml |
|
|
--- |
|
|
tags: |
|
|
- fraud-detection |
|
|
- machine-learning |
|
|
- streamlit |
|
|
- e-commerce |
|
|
- security |
|
|
datasets: |
|
|
- fraud-detection-dataset |
|
|
--- |
|
|
``` |
|
|
|
|
|
## π§βπ» Local Development |
|
|
1. Install dependencies: |
|
|
```bash |
|
|
pip install -r requirements.txt |
|
|
``` |
|
|
2. Run the app: |
|
|
```bash |
|
|
streamlit run app.py |
|
|
``` |
|
|
|
|
|
## π³ Docker Deployment |
|
|
You can also run this app in a Docker container: |
|
|
|
|
|
1. Build the Docker image: |
|
|
```bash |
|
|
docker build -t fraudlens-app . |
|
|
``` |
|
|
2. Run the container: |
|
|
```bash |
|
|
docker run -p 8501:8501 fraudlens-app |
|
|
``` |
|
|
|
|
|
The app will be available at [http://localhost:8501](http://localhost:8501). |
|
|
|
|
|
## π Deploy on Hugging Face Spaces |
|
|
1. Push this repo (with all files, including .pkl models) to a public GitHub repository. |
|
|
2. Create a new Space on [Hugging Face Spaces](https://huggingface.co/spaces) and select **Streamlit** as the SDK. |
|
|
3. In "Repository URL", enter your GitHub repo URL. |
|
|
4. The app will build and deploy automatically! |
|
|
|
|
|
> **Note:** For Docker-based Spaces, select the **Docker** SDK and ensure your Dockerfile is present in the repo. |
|
|
|
|
|
### Space Configuration Files |
|
|
- **app.py**: Main Streamlit application entry point |
|
|
- **requirements.txt**: Python dependencies |
|
|
- **Dockerfile**: For Docker-based deployment |
|
|
- **README.md**: Space metadata and documentation |
|
|
|
|
|
## π¦ Requirements |
|
|
All dependencies are listed in `requirements.txt`. |
|
|
|
|
|
## π License |
|
|
MIT |