File size: 2,484 Bytes
42bb626
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
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