Downloads · 30 days
748
3% of all-time downloads
ElSlay/BERT-Phishing-Email-Model
BERT-Phishing-Email-Model is a text classification model from ElSlay. Use it when you need a label for a piece of text. It is set up for transformers.
This repository contains the fine-tuned BERT model for detecting phishing emails. The model has been trained to classify emails as either phishing or legitimate based on their body text.
Downloads · 30 days
748
3% of all-time downloads
All-time downloads
23.3K
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
This repository contains the fine-tuned BERT model for detecting phishing emails. The model has been trained to classify emails as either phishing or legitimate based on their body text.
pip install transformers torch
from transformers import BertForSequenceClassification, BertTokenizer
import torch
# Replace with your Hugging Face model repo name
model_name = 'ElSlay/BERT-Phishing-Email-Model'
# Load the pre-trained model and tokenizer
model = BertForSequenceClassification.from_pretrained(model_name)
tokenizer = BertTokenizer.from_pretrained(model_name)
# Ensure the model is in evaluation mode
model.eval()
# Input email text
email_text = "Your email content here"
# Tokenize and preprocess the input text
inputs = tokenizer(email_text, return_tensors="pt", truncation=True, padding='max_length', max_length=512)
# Make the prediction
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predictions = torch.argmax(logits, dim=-1)
# Interpret the prediction
result = "Phishing" if predictions.item() == 1 else "Legitimate"
print(f"Prediction: {result}")