Downloads · 30 days
7
39% of all-time downloads
CloveAI/bert-sms-detector
bert-sms-detector is a machine learning model from CloveAI. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
bert-sms-detector is a fine-tuned BERT-based model for SMS spam detection. It classifies input text messages as spam or ham (not spam).
Downloads · 30 days
7
39% of all-time downloads
All-time downloads
18
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
bert-sms-detector is a fine-tuned BERT-based model for SMS spam detection.
It classifies input text messages as spam or ham (not spam).
bert-base-uncased!pip install transformers
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
model_name = "alanjoshua2005/bert-sms-detector"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
texts = [
"Congratulations! You've won a free ticket to the Bahamas.",
"Hey, are we still meeting tomorrow at 5 PM?",
"Free entry in 2 tickets to the concert. Text WIN to 80088."
]
label_map = {"LABEL_0": "Not Spam", "LABEL_1": "Spam"}
results = classifier(texts)
for text, result in zip(texts, results):
print(f"Text: {text}\nPrediction: {label_map[result['label']]}\n")