Downloads · 30 days
26
12% of all-time downloads
didulantha/sms-spam-detector
sms-spam-detector is a text classification model from didulantha. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
Fine-tuned DistilBERT model for detecting spam SMS messages.
Downloads · 30 days
26
12% of all-time downloads
All-time downloads
220
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
Fine-tuned DistilBERT model for detecting spam SMS messages.
Performance:
from transformers import pipeline
classifier = pipeline("text-classification", model="didulantha/sms-spam-detector")
result = classifier("Win a free prize now!")
print(result)
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
import torch
tokenizer = DistilBertTokenizer.from_pretrained("didulantha/sms-spam-detector")
model = DistilBertForSequenceClassification.from_pretrained("didulantha/sms-spam-detector")
def predict(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
return "SPAM" if probs[0][1] > 0.5 else "HAM"
print(predict("Free prize!"))
@misc{sms-spam-detector,
author = {Isuru Didulantha},
title = {SMS Spam Detector},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/didulantha/sms-spam-detector}
}