NewsGaurd / README.md
nallarahul's picture
Update README.md
377d9f6 verified
metadata
language: en
license: apache-2.0
tags:
  - fake-news-detection
  - bert
  - text-classification
  - transformers

NewsGuard AI - Fake News Detection Model

This model is a fine-tuned BERT-base-uncased model for detecting fake news. It is trained using the FakeNewsNet dataset.

Model Details

  • Base Model: BERT-base-uncased
  • Task: Text Classification (Fake vs. Real News)
  • Dataset: FakeNewsNet (GossipCop & PolitiFact)
  • Training Framework: Hugging Face Transformers
  • Metrics: Accuracy, Precision, Recall

How to Use

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]}")