Views
No views yet
hamza-amin/urdu-spam-dataset| Metric | Score |
|---|---|
| Accuracy | 0.983 |
| F1 Score | 0.982 |
| Precision | 0.993 |
| Recall | 0.972 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3model_name = "hamza-amin/urdu-spam-classifier"
4tokenizer = AutoTokenizer.from_pretrained(model_name)
5model = AutoModelForSequenceClassification.from_pretrained(model_name)
6def predict(text):
7 inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
8 outputs = model(**inputs)
9 probs = torch.softmax(outputs.logits, dim=1)
10 return probs.tolist()
11print(predict("یہ ایک ایمرجنسی ہے فوراً مدد کریں"))
12print(predict("ہیلو بس مذاق کر رہا تھا"))| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 | Precision | Recall |
|---|---|---|---|---|---|---|---|
| 0.1146 | 1.0 | 169 | 0.1139 | 0.9834 | 0.9826 | 0.9860 | 0.9792 |
| 0.0902 | 2.0 | 338 | 0.0954 | 0.9834 | 0.9825 | 0.9929 | 0.9722 |
| 0.0085 | 3.0 | 507 | 0.0972 | 0.9867 | 0.9859 | 1.0 | 0.9722 |