File size: 1,190 Bytes
c8d901b 2441c97 c8d901b 2441c97 c8d901b 2441c97 cd79521 c8d901b 145b757 cd79521 145b757 2441c97 145b757 2441c97 145b757 2441c97 145b757 2441c97 145b757 2441c97 | 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 | # Autopilot Email Classifier
A scikit-learn TF-IDF + Logistic Regression model that predicts whether an email is **purchase-related** (`purchase`) or not (`non-purchase`).
## Quick Usage
```bash
# 1️⃣ Clone this repository
git clone https://huggingface.co/Settlemate/autopilot-email-classifier
cd autopilot-email-classifier
# 2️⃣ Install dependencies
pip install -r requirements.txt
# 3️⃣ Load the model and classify
```
```python
import joblib
# Load Model
bundle = joblib.load("classifier.pkl")
pipeline = bundle["pipeline"]
threshold = bundle["threshold"]
# Function to classify email
def classify_email(subject: str, body: str) -> str:
text = f"{subject} {body}"
proba = pipeline.predict_proba([text])[0, 1]
return "purchase" if proba >= threshold else "non-purchase"
# Example usage
if __name__ == "__main__":
subj = "Solo founder, $80M exit, 6 months: The Base44 bootstrapped startup success story | Maor Shlomo"
body = """Base44's founder on bootstrapping to profitability, using AI to write 90% of his code, why he turned down VC money, and signing an acquisition deal as missiles were flying"""
print(classify_email(subj, body))
``` |