Downloads · 30 days
0
DarkNeuron-AI/darkneuron-spamdex-v1
darkneuron-spamdex-v1 is a text classification model from DarkNeuron-AI. Use it when you need a label for a piece of text. It is set up for sklearn. The card lists the license as mit.
A lightweight Naive Bayes + TF-IDF based spam detection model developed by DarkNeuronAI. It classifies emails as Spam (1) or Ham (0) with high accuracy and fast performance — ideal for simple text classification tasks.
Downloads · 30 days
0
Access
Public
Updated Oct 20, 2025
Repo size
384 KB
Likes
1
Public
Click a slice to open those files.
.pkl384 KB · 99%
From the Hugging Face model README
A lightweight Naive Bayes + TF-IDF based spam detection model developed by DarkNeuronAI.
It classifies emails as Spam (1) or Ham (0) with high accuracy and fast performance — ideal for simple text classification tasks.
spam_detection_model.pkl → Trained Naive Bayes modelspam_detection_vectorizer.pkl → TF-IDF vectorizer for text preprocessingexample_usage.py → Example code to use the modelrequirements.txt → Dependencies listfrom huggingface_hub import hf_hub_download
import joblib
import string
import re
# Download and load the vectorizer
vectorizer_path = hf_hub_download("DarkNeuron-AI/darkneuron-spamdex-v1", "spam_detection_vectorizer.pkl")
vectorizer = joblib.load(vectorizer_path)
# Download and load the trained model
model_path = hf_hub_download("DarkNeuron-AI/darkneuron-spamdex-v1", "spam_detection_model.pkl")
model = joblib.load(model_path)
# Text cleaning function
def clean_text(text):
text = text.lower() # lowercase
text = re.sub(r'\d+', '', text) # remove digits
text = text.translate(str.maketrans('', '', string.punctuation)) # remove punctuation
return text.strip() # remove extra spaces
# Example usage
email_text = "Congratulations! You are the topper!"
cleaned_email = clean_text(email_text)
# Wrap text in a list for vectorizer
email_vector = vectorizer.transform([cleaned_email])
# Predict
prediction = model.predict(email_vector)
print("Prediction:", "🚨 Spam" if prediction[0] == 1 else "✅ Not Spam")