edvaldomelo commited on
Commit
28a05fc
·
verified ·
1 Parent(s): ab1c52f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Refund Request Classifier
2
+
3
+ This repository contains a logistic regression model developed to classify whether an email is a **response to a refund request** or **not**.
4
+
5
+ ---
6
+
7
+ ## 🚀 Quick Start
8
+
9
+ ```python
10
+ from huggingface_hub import hf_hub_download
11
+ import joblib
12
+
13
+
14
+ # Load Model
15
+ model_path = hf_hub_download(
16
+ repo_id="Settlemate/refund-request-classifier",
17
+ filename="refund_request_classifier.pkl"
18
+ )
19
+
20
+ # Get Pipeline and Threshold
21
+ bundle = joblib.load(model_path)
22
+ pipeline = bundle["pipeline"]
23
+ threshold = bundle["threshold"]
24
+
25
+ # Functions to use the classifier
26
+ def classify_refund_request(subject: str, body: str) -> bool:
27
+ text = f"{subject} {body}"
28
+ proba = pipeline.predict_proba([text])[0, 1]
29
+ return "refund-request" if proba >= threshold else "non-refund-request"
30
+
31
+
32
+ # Example usage
33
+ if __name__ == "__main__":
34
+ subject = "Order Order #210023: protocol REF-7701 assigned"
35
+ body = """<html><body><p>Protocol generated: REF-7701</p><p>Protocol REF-7701 has been issued for your refund request.</p><p>Status updates will be provided within 4 business days.</p><p>Check for updates by logging into our website.</p><p>Our customer care team is available for clarifications.</p><p>Sincerely,<br>QuickMart Support Team</p></body></html>"""
36
+ print(classify_refund_request(subject, body))