edvaldomelo's picture
Update README.md
59c8835 verified
# Refund Request Classifier
This repository contains a logistic regression model developed to classify whether an email is a **response to a refund request** or **not**.
---
## 🚀 Quick Start
```python
from huggingface_hub import hf_hub_download
import joblib
# Load Model
model_path = hf_hub_download(
repo_id="Settlemate/refund-request-classifier",
filename="refund_request_classifier.pkl"
)
# Get Pipeline and Threshold
bundle = joblib.load(model_path)
pipeline = bundle["pipeline"]
threshold = bundle["threshold"]
# Functions to use the classifier
def classify_refund_request(subject: str, body: str) -> bool:
text = f"{subject} {body}"
proba = pipeline.predict_proba([text])[0, 1]
return "refund-request" if proba >= threshold else "non-refund-request"
# Example usage
if __name__ == "__main__":
subject = "Order Order #210023: protocol REF-7701 assigned"
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>"""
print(classify_refund_request(subject, body))
```
---
> **Note:** This model was trained using the <a href="https://huggingface.co/datasets/Settlemate/refund_response" target="_blank" rel="noopener noreferrer">dataset</a>, split into training, validation, and test sets.