Downloads · 30 days
19
12% of all-time downloads
nallarahul/NewsGaurd
NewsGaurd is a text classification model from nallarahul. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned BERT-base-uncased model for detecting fake news. It is trained using the FakeNewsNet dataset.
Downloads · 30 days
19
12% of all-time downloads
All-time downloads
164
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 model is a fine-tuned BERT-base-uncased model for detecting fake news. It is trained using the FakeNewsNet dataset.
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model_path = "your-huggingface-username/newsguard-ai-fake-news"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSequenceClassification.from_pretrained(model_path)
text = "Some news article text here..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.nn.functional.softmax(outputs.logits, dim=-1)
prediction = "Fake" if torch.argmax(probs) == 0 else "Real"
print(f"Prediction: {prediction}, Confidence: {probs.tolist()[0]}")