File size: 5,647 Bytes
d5761e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1f9107d
 
 
 
 
 
 
 
 
 
d5761e7
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
# ๐Ÿš€ Introducing MailSensei
## Your Cutting-Edge Email Management Companion ๐Ÿ“งโœ‚๏ธ

<!-- <img  src="https://i.ibb.co/Bg6h8qp/your-image.png"  alt="MailSensei Image"> -->
<!-- ![Image](./PeerlistHackathon_CoverImg.png) -->


![Cover Image](https://raw.githubusercontent.com/Deven1902/Peerlist-Hackathon/main/PeerlistHackathon_CoverImg.png)

Tired of sifting through endless emails, only to discover they're not worth your time? Ever missed important messages due to email overload? In today's digital age, our inboxes are overflowing with both vital and distracting content. You might spend precious time on lengthy, irrelevant emails. MailSensei is here to revolutionize your email experience by addressing these challenges. ๐Ÿš€

### Need for a Solution ๐Ÿค”

![Email Overload](https://media.giphy.com/media/OothRHNJSCaTS/giphy.gif)

CEOs and business professionals often receive hundreds of emails daily, making efficient email management essential. MailSensei offers a solution to navigate this email overload, ensuring that crucial messages are never missed and time is spent more productively. ๐Ÿ•’๐Ÿ’ผ

### How to run the project ๐ŸŒŸ
- Visit the following URL to locate the project:- **[https://replit.com/@DevenNandapurka/Peerlist-Hackathon](https://replit.com/@DevenNandapurka/Peerlist-Hackathon)**

- You will see the replit workspace. Click the `Run` button. 

- You need to setup an **App Password** before you can set credentails for MailSensei. 
Here we have attached an article to guide you through setting up an app password -> **[Generate your App Password](https://support.google.com/mail/answer/185833?hl=en)**

- Once the project is up and running, enter your credentials in the project and click the `Set Credentials` button. 

- Click the `Fetch Emails` button -> and all of your unread emails will be fetched and rendered in a short summary format. 

### Our Unique Approach ๐ŸŒŸ

- **Gmail Credentials Setup:** Securely collect your "Gmail Address" and "App Password" via Streamlit to maintain the confidentiality of your email data. ๐Ÿ”’

- **IMAP Connection:** Establish a connection to your Gmail account using IMAP (Internet Message Access Protocol) for seamless email access. ๐ŸŒ

- **Email Decoding:** Decode your emails to extract essential information, including "From," "Subject," and email content. ๐Ÿ“ค

- **Email Summarization:** Utilize Large Language Models (LLMs), specifically "distilbart-cnn-12-6," to generate concise summaries of your emails, saving you valuable time. ๐Ÿ“โณ

- **Tag Generation:** Intelligently categorize and organize emails using "t5-base-tag-generation." Tags are displayed alongside email details. ๐Ÿท๏ธ

- **Streamlined Presentation:** Display email information in an ordered format, including "From," "Subject," and associated tags for easy reference. ๐Ÿ“Š

- **Dropdown Summaries:** Provide a dropdown button for each email, allowing users to access the summary with a single click, enhancing readability. ๐Ÿ“‘

- **Original Email Link:** Include a convenient link at the end of each summary that directs users to the original email for further context and action. ๐Ÿ”—

### Technology Stack ๐Ÿ› ๏ธ

- **Programming Languages:** Python
- **Web Framework:** Streamlit
- **Machine Learning Framework:** PyTorch
- **Email Access:** IMAP (Internet Message Access Protocol)
- **Text Processing:** Transformers library (from Hugging Face)
- **Logging:** Python Logging Library

### Models Used ๐Ÿง 

1. **Large Language Model (LLM) for Summarization:**
   - **Model:** `sshleifer/distilbart-cnn-12-6` (DistilBART)
   - **Purpose:** Summarizes email content to generate concise summaries.
   - **Utilized for:** Email summarization.

2. **Spam Detection Model(Currently commented out as results are not accurate) :**
   - **Model:** `1aurent/distilbert-base-multilingual-cased-finetuned-email-spam` (DistilBERT)
   - **Purpose:** Detects spam emails within the inbox.
   - **Utilized for:** Spam filtering.

3. **Tag Generation Model:**
   - **Model:** `fabiochiu/t5-base-tag-generation` (T5)
   - **Purpose:** Generates tags to categorize and organize emails.
   - **Utilized for:** Email tagging and categorization.


### Running locally:
Requirements:
- Python 3.7+
- cuda (optional for GPU support)
- Minimum 4GB RAM is required to run the app

clone the repository:
```bash
git clone https://github.com/Deven1902/Peerlist-Hackathon
```
optionally create a virtual environment:
```bash
python -m venv venv
```
activate the virtual environment:

for Linux
```bash
source venv/bin/activate
```

for Windows
```bash
venv\Scripts\activate
```

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

run the app:
```bash
streamlit run app/streamlit_app.py
```

### Future Enhancements ๐Ÿš€๐Ÿ”ฎ

- **Improved Spam Filtering:** We'll enhance the accuracy of our spam detection algorithm for a cleaner inbox. ๐Ÿšฎ

- **Tag Collections & Sharing:** Users can create and share tag collections, streamlining collaboration and productivity. ๐Ÿš€๐Ÿ“Š

- **Custom Tag Generation:** Customize your own tag generation models for tailored email organization. ๐Ÿท๏ธ

- **User Preferences:** Fine-tune MailSensei with preferences like summarization length and tag rules for a personalized experience. โš™๏ธ๐Ÿ‘ค


*"Initially, we used OpenAI keys for all our app functions. However, we later changed our approach as some users may not have premium keys, and we wanted to ensure accessibility without additional costs. ๐Ÿ˜‰๐Ÿ˜Š"*


---
title: mailsensei
emoji: ๐Ÿ“ง
colorFrom: blue
colorTo: blue
sdk: streamlit
sdk_version: 1.28.2
app_file: app.py
pinned: false
---