faysal725 commited on
Commit
d57a79b
Β·
verified Β·
1 Parent(s): 5a863b3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md CHANGED
@@ -1,3 +1,114 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ language:
4
+ - en
5
+ tags:
6
+ - text-classification
7
+ - support-tickets
8
+ - setfit
9
+ - nlp
10
+ - customer-support
11
+ metrics:
12
+ - f1
13
  ---
14
+
15
+ # 🎫 Support Ticket Classifier
16
+
17
+ Automatically classifies customer support tickets by **category** and **urgency** using a fine-tuned SetFit model trained on 30,000+ real support tickets.
18
+
19
+ ## What It Does
20
+
21
+ **Input:** Raw support ticket text
22
+ **Output:** Category + confidence score + urgency level
23
+
24
+ ```json
25
+ {
26
+ "category": "billing",
27
+ "confidence": 0.79,
28
+ "urgency": "high"
29
+ }
30
+ ```
31
+
32
+ ## Categories
33
+
34
+ | Category | Example ticket |
35
+ |---|---|
36
+ | `billing` | "I was charged twice for my subscription" |
37
+ | `technical` | "My account keeps logging me out" |
38
+ | `complaint` | "This service is completely unacceptable" |
39
+ | `refund` | "I want to cancel and get my money back" |
40
+
41
+ ## Urgency Levels
42
+
43
+ | Level | When assigned |
44
+ |---|---|
45
+ | `high` | Fraud, service down, unauthorized charges, locked out |
46
+ | `medium` | General issues, standard requests |
47
+ | `low` | General questions, curiosity, minor changes |
48
+
49
+ ## Performance
50
+
51
+ | Metric | Score |
52
+ |---|---|
53
+ | Weighted F1 | **82%** |
54
+ | Complaint F1 | 92% |
55
+ | Technical F1 | 82% |
56
+ | Billing F1 | 79% |
57
+ | Refund F1 | 68% |
58
+
59
+ Trained on 30,571 labeled tickets from Kaggle + HuggingFace datasets.
60
+ Evaluated on a held-out test set of 3,058 tickets.
61
+
62
+ ## Why Use This Instead of an LLM?
63
+
64
+ - βœ… **100x cheaper per call** than GPT-4 at volume
65
+ - βœ… **Fast** β€” under 200ms per ticket
66
+ - βœ… **Private** β€” runs on your own server, data never leaves your infrastructure
67
+ - βœ… **No vendor lock-in** β€” no API key, no per-token billing
68
+ - βœ… **GDPR friendly** β€” fully on-premise capable
69
+
70
+ ## Quick Start
71
+
72
+ ### Install dependencies
73
+ ```bash
74
+ pip install setfit==1.0.3 sentence-transformers==2.7.0 transformers==4.40.2 huggingface_hub==0.23.5 scikit-learn numpy
75
+ ```
76
+
77
+ ### Run predictions
78
+ ```python
79
+ from predict import predict_ticket
80
+
81
+ result = predict_ticket("I was charged twice and need a refund immediately")
82
+ print(result)
83
+ # {"category": "billing", "confidence": 0.79, "urgency": "high"}
84
+ ```
85
+
86
+ ## Files in This Repo
87
+
88
+ | File | Description |
89
+ |---|---|
90
+ | `predict.py` | Ready-to-run prediction script |
91
+ | `requirements.txt` | Pinned dependencies |
92
+ | `category_model/` | Fine-tuned SetFit classifier |
93
+ | `calibration.pkl` | Platt scaling confidence calibration |
94
+ | `label_mappings.pkl` | Label encoders |
95
+
96
+ ## Tech Stack
97
+
98
+ - **Model:** SetFit (Sentence Transformers fine-tuning)
99
+ - **Base model:** `paraphrase-MiniLM-L3-v2`
100
+ - **Training data:** 30,571 labeled support tickets
101
+ - **Confidence calibration:** Platt scaling on held-out validation set
102
+ - **Urgency:** Keyword-rule layer (transparent and auditable)
103
+
104
+ ## Get the Full Docker API Version
105
+
106
+ Want a production-ready REST API you can deploy to your own server in minutes?
107
+
108
+ The **Docker version** includes:
109
+ - FastAPI wrapper (`POST /predict` endpoint)
110
+ - Dockerfile β€” one command to deploy anywhere
111
+ - Full setup guide
112
+
113
+ πŸ‘‰ **[Get the Docker API version on Gumroad](#)**
114
+ ## Sample Results