File size: 4,013 Bytes
806623d
 
 
 
 
 
 
 
 
 
 
 
fe13e9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a8b53f
b05032d
 
 
 
 
 
 
 
 
 
 
 
 
 
5a8b53f
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---
title: Smart Email Classification App
emoji: πŸ“§
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: "1.25.0"
app_file: app.py
pinned: false
---


# πŸ“§ Smart Email Classifier: Classifying emails using Natural Language Processing (NLP)

[![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://python.org)
[![Streamlit](https://img.shields.io/badge/Streamlit-App%20Framework-red.svg)](https://streamlit.io/)
[![License](https://img.shields.io/badge/License-Apache-yellow.svg)](https://www.apache.org/licenses/LICENSE-2.0.txt)

> **Smart Email Classifier application is your companion to classify emails of different types based on email subject or body using advanced Natural Language Processing (NLP) techniques and fine-tuned model.**


## 🧠 Categories
- πŸ“’ **Promotions**
- 🚫 **Spam**
- πŸ’¬ **Social Media Updates**
- πŸ—£οΈ **Forum Updates**
- πŸ”’ **Code Verification**
- πŸ’Ό **Work Updates**

---

## 🧩 Project Structure

```
Email-Classifier-AI/
β”‚
β”œβ”€β”€ app.py                                # Main Streamlit application
β”œβ”€β”€ .env                                  # Secret API Keys (ignored by Git)
β”œβ”€β”€ requirements.txt                      # Required Python dependencies
β”œβ”€β”€ Dockerfile                            # Docker setup for Hugging Face deployment
β”œβ”€β”€ README.md                             # Project documentation
└── .gitignore                            # Ignored files
```

---

## βš™οΈ Installation and Setup

### 1️⃣ Create a Virtual Environment (Recommended)

```bash
python -m venv venv
source venv/bin/activate       # (Linux/Mac)
venv\Scripts\activate          # (Windows)
```

### 2️⃣ Install Dependencies

```bash
pip install -r requirements.txt
```

### 3️⃣ Add Your API Keys (if any)

Create a `.env` file in your project root:

```bash
HF_TOKEN=<Your HF Token>
MODEL_REPO=kaisarhossain/email-classifier-distilbert-finetuned-kaisar
```

---

## ▢️ Run the App Locally

```bash
streamlit run app.py
```

The app will launch automatically in your browser at:
```
http://localhost:8501
```

---

## 🐳 Deploying on Hugging Face (Docker Method)

### 1️⃣ Create a `Dockerfile`
Example:
```dockerfile
# Base image
FROM python:3.10

# Set working directory
WORKDIR /app

# Copy project files
COPY . .

# Install dependencies
RUN pip install -r requirements.txt

# Expose Streamlit port
EXPOSE 8501

# Run Streamlit app
CMD ["streamlit", "run", "email_classifier_streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
```

### 2️⃣ Push to Hugging Face Space

- Create a new **Hugging Face Space** β†’ Select **Docker** as the SDK.  
- Connect your **GitHub repository** or upload the project manually.  
- Hugging Face automatically builds and runs your app.

---

## 🧾 Example Usage

**Input:**  
> "Your verification code is 348211. Please do not share it with anyone."

**Predicted Category:**  
> πŸ”’ **Code Verification**

---

## πŸ’‘ Future Enhancements
- Add email body + subject dual-input model  
- Integrate real-time Gmail API ingestion  
- Add multilingual email classification  
- Enable fine-tuning with user-specific data  

---

## 🀝 Contributing
Contributions are welcome!  
Fork this repo, make your improvements, and submit a pull request.

---

## πŸͺͺ License
This project is licensed under the **Apache 2.0 License** β€” feel free to use and modify it.

---

## πŸ‘¨β€πŸ’» Author
Mohammed Golam Kaisar Hossain Bhuyan
πŸš€ AI | ML | NLP | Deep Learning  
πŸ”— [LinkedIn](https://www.linkedin.com/in/kaisarhossain) | [GitHub](https://github.com/kaisarhossain)

---
=======
---
title: Smart Email Classification App
emoji: 🐒
colorFrom: indigo
colorTo: green
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: Smart-Email-Classification-App
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
>>>>>>> f3f984eb444ce50d2f26830c247442faab422fb5