--- license: mit language: - en metrics: - accuracy - precision - recall - f1 pipeline_tag: text-classification library_name: sklearn tags: - Email Spam Detection - Naive Bayes - TF-IDF --- # 🧠 SpamDex - Spam Detection Model (v1.0) 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. --- ## 🚀 Features - Fast and efficient — works on low-end systems - Trained with real-world email dataset - Perfect for **text classification** and **spam filtering** projects - Easy to use and integrate --- ## 🚀 Model Overview - **Algorithm:** Naive Bayes (MultinomialNB) - **Vectorization:** TF-IDF (Term Frequency - Inverse Document Frequency) - **Goal:** Classify email/text messages as Spam or Ham - **Performance:** High accuracy on real-world datasets --- ## 🧩 Files Included - `spam_detection_model.pkl` → Trained Naive Bayes model - `spam_detection_vectorizer.pkl` → TF-IDF vectorizer for text preprocessing - `example_usage.py` → Example code to use the model - `requirements.txt` → Dependencies list --- ## 🏷️ Prediction Labels(Binary) - **0:** Represent Ham(Not Spam) Prediction - **1:** Represent Spam Prediction ## 💡 How to Use(Example Code) ```python from 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") ``` # Developed With ❤️ By DarkNeuronAI