Update README.md
Browse files
README.md
CHANGED
|
@@ -7,4 +7,32 @@ pipeline_tag: text-classification
|
|
| 7 |
library_name: bertopic
|
| 8 |
tags:
|
| 9 |
- code
|
| 10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
library_name: bertopic
|
| 8 |
tags:
|
| 9 |
- code
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# SpamHunter Model
|
| 13 |
+
|
| 14 |
+
This is a fine-tuned BERT model for spam detection.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
- **Base Model**: bert-base-uncased
|
| 18 |
+
- **Dataset**: Custom spam emails dataset
|
| 19 |
+
- **Training Steps**: 3 epochs
|
| 20 |
+
- **Validation Accuracy**: ~99%
|
| 21 |
+
|
| 22 |
+
## How to Use
|
| 23 |
+
|
| 24 |
+
### Direct Integration with Transformers
|
| 25 |
+
```python
|
| 26 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
| 27 |
+
|
| 28 |
+
# Load model and tokenizer
|
| 29 |
+
tokenizer = BertTokenizer.from_pretrained("your-username/SpamHunter")
|
| 30 |
+
model = BertForSequenceClassification.from_pretrained("your-username/SpamHunter")
|
| 31 |
+
|
| 32 |
+
# Example
|
| 33 |
+
text = "Congratulations! You've won a $1000 gift card. Click here to claim now."
|
| 34 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 35 |
+
outputs = model(**inputs)
|
| 36 |
+
prediction = outputs.logits.argmax(-1).item()
|
| 37 |
+
|
| 38 |
+
print("Spam" if prediction == 1 else "Not Spam")
|