Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5model_name = "nhellyercreek/url-phishing-classifier"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Example inference
10text = "Your email or URL text here"
11inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
12outputs = model(**inputs)
13predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
14
15# Get prediction
16predicted_class = predictions.argmax().item()
17confidence = predictions[0][predicted_class].item()
18
19print(f"Predicted class: {predicted_class} (phishing=1, safe=0)")
20print(f"Confidence: {confidence:.4f}")1@misc{nhellyercreek_url_phishing_classifier,
2 title={Url Phishing Classifier},
3 author={Your Name},
4 year={2024},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/nhellyercreek/url-phishing-classifier}}
7}