Update to V11: 99.3% F1, 97% conversation accuracy, new examples
Browse files
app.py
CHANGED
|
@@ -142,21 +142,32 @@ def classify(message: str):
|
|
| 142 |
|
| 143 |
|
| 144 |
EXAMPLES = [
|
|
|
|
| 145 |
["my number is 05321234567 call me anytime"],
|
| 146 |
["numaram 05321234567 bana yazabilirsin"],
|
| 147 |
["رقمي 0501234567 تواصل معي"],
|
|
|
|
| 148 |
["follow me on instagram @creator_official"],
|
| 149 |
["email me at creator@gmail.com"],
|
|
|
|
| 150 |
["i will send you my whatsapp tomorrow"],
|
| 151 |
["check my bio my number is right there"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
["your order number is ORD-784321"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
["05321234567 this number is a scammer do not call"],
|
| 154 |
["bake at 180 degrees celsius for 45 minutes"],
|
| 155 |
-
|
| 156 |
["my number is 00000000000 lol just kidding"],
|
| 157 |
-
["رقم الطلب ORD-784321"],
|
| 158 |
-
["if we agree on terms i will share my number"],
|
| 159 |
-
["my old number was 05321234567 it might still work"],
|
| 160 |
]
|
| 161 |
|
| 162 |
with gr.Blocks(
|
|
@@ -165,13 +176,13 @@ with gr.Blocks(
|
|
| 165 |
) as demo:
|
| 166 |
gr.Markdown(
|
| 167 |
"""
|
| 168 |
-
# 🔍 PII Intent Classifier
|
| 169 |
### Multilingual context-aware PII detection (Turkish, Arabic, English)
|
| 170 |
|
| 171 |
Type any message below. The model will automatically detect entities (phone numbers, emails, handles, etc.)
|
| 172 |
and determine if the message contains **intent to share personal contact information**.
|
| 173 |
|
| 174 |
-
**Model:** [gorkem371/pii-intent-classifier-xlmr-large](https://huggingface.co/gorkem371/pii-intent-classifier-xlmr-large) — XLM-RoBERTa Large, 550M params
|
| 175 |
"""
|
| 176 |
)
|
| 177 |
|
|
@@ -216,7 +227,9 @@ with gr.Blocks(
|
|
| 216 |
using regex, then classifies each one for PII sharing intent using a fine-tuned XLM-RoBERTa Large model.
|
| 217 |
If no entity is found, it analyzes the message for implicit intent (e.g., "I'll send my number later").
|
| 218 |
|
| 219 |
-
**
|
|
|
|
|
|
|
| 220 |
"""
|
| 221 |
)
|
| 222 |
|
|
|
|
| 142 |
|
| 143 |
|
| 144 |
EXAMPLES = [
|
| 145 |
+
# PII - Direct sharing
|
| 146 |
["my number is 05321234567 call me anytime"],
|
| 147 |
["numaram 05321234567 bana yazabilirsin"],
|
| 148 |
["رقمي 0501234567 تواصل معي"],
|
| 149 |
+
# PII - Social media / email
|
| 150 |
["follow me on instagram @creator_official"],
|
| 151 |
["email me at creator@gmail.com"],
|
| 152 |
+
# PII - Implicit intent
|
| 153 |
["i will send you my whatsapp tomorrow"],
|
| 154 |
["check my bio my number is right there"],
|
| 155 |
+
["if we agree on terms i will share my number"],
|
| 156 |
+
# PII - Humor + real number (V11 improvement)
|
| 157 |
+
["numaram pizza siparişi gibi 05321234567 haha 😂"],
|
| 158 |
+
# PII - Old number still visible
|
| 159 |
+
["my old number was 05321234567 it might still work"],
|
| 160 |
+
# NOT PII - Order/tracking numbers
|
| 161 |
["your order number is ORD-784321"],
|
| 162 |
+
["siparis numaraniz SPN-78432156"],
|
| 163 |
+
# NOT PII - Room number / postal code (V11 improvement)
|
| 164 |
+
["oda numaram 532 otelde buluşalım"],
|
| 165 |
+
["posta kodu 34720 Kadıköy İstanbul"],
|
| 166 |
+
# NOT PII - Scam warning / non-contact
|
| 167 |
["05321234567 this number is a scammer do not call"],
|
| 168 |
["bake at 180 degrees celsius for 45 minutes"],
|
| 169 |
+
# NOT PII - Sarcasm
|
| 170 |
["my number is 00000000000 lol just kidding"],
|
|
|
|
|
|
|
|
|
|
| 171 |
]
|
| 172 |
|
| 173 |
with gr.Blocks(
|
|
|
|
| 176 |
) as demo:
|
| 177 |
gr.Markdown(
|
| 178 |
"""
|
| 179 |
+
# 🔍 PII Intent Classifier (V11)
|
| 180 |
### Multilingual context-aware PII detection (Turkish, Arabic, English)
|
| 181 |
|
| 182 |
Type any message below. The model will automatically detect entities (phone numbers, emails, handles, etc.)
|
| 183 |
and determine if the message contains **intent to share personal contact information**.
|
| 184 |
|
| 185 |
+
**Model:** [gorkem371/pii-intent-classifier-xlmr-large](https://huggingface.co/gorkem371/pii-intent-classifier-xlmr-large) — XLM-RoBERTa Large, 550M params | **F1: 99.3%** · **Conversation accuracy: 97.0%** · Trained on 41K samples
|
| 186 |
"""
|
| 187 |
)
|
| 188 |
|
|
|
|
| 227 |
using regex, then classifies each one for PII sharing intent using a fine-tuned XLM-RoBERTa Large model.
|
| 228 |
If no entity is found, it analyzes the message for implicit intent (e.g., "I'll send my number later").
|
| 229 |
|
| 230 |
+
**V11 improvements:** Understands humor + real numbers as PII, distinguishes room/postal/tracking numbers from real phone numbers, handles scam warnings with visible numbers, and 6 new NOT-PII categories.
|
| 231 |
+
|
| 232 |
+
**Author:** [Gorkem Yildiz](https://gorkemyildiz.com) · **Dataset:** [pii-intent-detection-multilingual](https://huggingface.co/datasets/gorkem371/pii-intent-detection-multilingual) (41,427 samples)
|
| 233 |
"""
|
| 234 |
)
|
| 235 |
|