Downloads · 30 days
13
8% of all-time downloads
AyushSingh2278/fake-news-detector
fake-news-detector is a text classification model from AyushSingh2278. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This is a fine-tuned BERT model for fake news detection. It classifies a given news headline or article as real or fake.
Downloads · 30 days
13
8% of all-time downloads
All-time downloads
155
Public
Repo size
876 MB
Likes
0
Public
Click a slice to open those files.
.bin438 MB · 100%
From the Hugging Face model README
This is a fine-tuned BERT model for fake news detection.
It classifies a given news headline or article as real or fake.
bert-base-uncasedBertTokenizerFastfrom transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("AyushSingh2278/fake-news-detector")
model = AutoModelForSequenceClassification.from_pretrained("AyushSingh2278/fake-news-detector")
text = "Breaking: AI replaces all journalists!"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
pred = outputs.logits.argmax(-1).item()
print("Fake News" if pred == 1 else "Real News")