File size: 2,676 Bytes
30559f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbf975c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30559f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbf975c
 
 
 
 
 
 
 
 
 
9070ad6
 
 
 
 
 
 
 
 
 
 
 
 
 
dbf975c
 
 
 
 
 
9070ad6
 
30559f0
 
 
 
 
 
dbf975c
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
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