hugocarvalhopc's picture
Update README.md
145b757 verified
# 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))
```