Update README.md
Browse files
README.md
CHANGED
|
@@ -12,16 +12,18 @@ cd autopilot-email-classifier
|
|
| 12 |
# 2️⃣ Install dependencies
|
| 13 |
pip install -r requirements.txt
|
| 14 |
|
| 15 |
-
3️⃣ Load the model and classify
|
|
|
|
|
|
|
| 16 |
```python
|
| 17 |
import joblib
|
| 18 |
|
| 19 |
-
bundle
|
| 20 |
-
pipeline
|
| 21 |
threshold = bundle["threshold"]
|
| 22 |
|
| 23 |
def classify_email(subject: str, body: str) -> str:
|
| 24 |
-
text
|
| 25 |
proba = pipeline.predict_proba([text])[0, 1]
|
| 26 |
return "purchase" if proba >= threshold else "non-purchase"
|
| 27 |
|
|
@@ -29,7 +31,7 @@ def classify_email(subject: str, body: str) -> str:
|
|
| 29 |
if __name__ == "__main__":
|
| 30 |
subj = ("Solo founder, $80M exit, 6 months: "
|
| 31 |
"The Base44 bootstrapped startup success story | Maor Shlomo")
|
| 32 |
-
body = ("Base44
|
| 33 |
"90% of his code, why he turned down VC money, and signing an "
|
| 34 |
"acquisition deal as missiles were flying")
|
| 35 |
print(classify_email(subj, body))
|
|
|
|
| 12 |
# 2️⃣ Install dependencies
|
| 13 |
pip install -r requirements.txt
|
| 14 |
|
| 15 |
+
# 3️⃣ Load the model and classify
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
```python
|
| 19 |
import joblib
|
| 20 |
|
| 21 |
+
bundle = joblib.load("classifier.pkl")
|
| 22 |
+
pipeline = bundle["pipeline"]
|
| 23 |
threshold = bundle["threshold"]
|
| 24 |
|
| 25 |
def classify_email(subject: str, body: str) -> str:
|
| 26 |
+
text = f"{subject} {body}"
|
| 27 |
proba = pipeline.predict_proba([text])[0, 1]
|
| 28 |
return "purchase" if proba >= threshold else "non-purchase"
|
| 29 |
|
|
|
|
| 31 |
if __name__ == "__main__":
|
| 32 |
subj = ("Solo founder, $80M exit, 6 months: "
|
| 33 |
"The Base44 bootstrapped startup success story | Maor Shlomo")
|
| 34 |
+
body = ("Base44's founder on bootstrapping to profitability, using AI to write "
|
| 35 |
"90% of his code, why he turned down VC money, and signing an "
|
| 36 |
"acquisition deal as missiles were flying")
|
| 37 |
print(classify_email(subj, body))
|