An end-to-end, high-performance web platform that evaluates the credibility of news articles. The system uses an Ensemble Classifier combining a fast keyword-based Linear SVM (baseline) and a state-of-the-art RoBERTa Transformer (deep learning) to perform real-time predictions. It includes an interactive dashboard featuring credibility visualization, highlighted keywords, reasoning insights, and automatic article scraping.
- Hybrid Model Ensemble: Combines classic statistical ML (Linear SVM + TF-IDF) with deep context-aware NLP (RoBERTa Sequence Classifier).
- Reasoning & Explanation: Shows highlighted keywords and lists reasoning explanations dynamically.
- Automatic Article Scraping: Paste a news URL to fetch the article body automatically using
newspaper3k. - Visual Credibility Dashboard: Built with React, Tailwind CSS, TypeScript, and Recharts horizontal charts.
- Conflict Detection: Alerts users if the keyword model and the transformer model disagree.
Fake-News-Detection/
├── backend/ # FastAPI Web server & model training scripts
│ ├── main.py # REST API entrypoint
│ ├── model_loader.py # Prediction ensemble manager
│ ├── scraper.py # Article web crawler (newspaper3k)
│ ├── train_svm.py # Linear SVM training script
│ ├── train_roberta.py # RoBERTa fine-tuning script
│ └── requirements.txt # Python dependencies
├── data/ # Data processing utilities
│ ├── build_combined_dataset.py # Merges & balances Kaggle, ISOT, LIAR, & FakeNewsNet
│ └── liar_dataset/ # Benchmark datasets
├── frontend/ # React SPA Dashboard (Vite + TS + Tailwind)
│ ├── src/ # React source files (components, charts, API)
│ └── package.json # Node dependencies
├── models/ # Model weight storage (ignored from git commit)
└── fake-news-detector.ipynb # Jupyter Notebook for prototyping
Ensure you have the following installed:
- Python 3.9+
- Node.js (v18+) & npm
- Open a terminal and navigate to the backend directory:
cd backend - Create and activate a Python virtual environment:
python -m venv venv # On Windows (PowerShell): .\venv\Scripts\Activate.ps1 # On macOS/Linux: source venv/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Start the FastAPI development server:
The server will start at
uvicorn main:app --reload --port 8000
http://localhost:8000.
- Open a new terminal and navigate to the frontend directory:
cd frontend - Install npm packages:
npm install
- Start the Vite development server:
The frontend dashboard will be available at
npm run dev
http://localhost:5173.
If you wish to re-train the classification models from scratch:
- Build the dataset:
Make sure you download the raw Kaggle datasets (
Fake.csv/True.csvorisot_fake.csv/isot_real.csv) into thedata/folder, then run:python data/build_combined_dataset.py
- Train the SVM Baseline:
python backend/train_svm.py
- Train the RoBERTa Transformer:
Note: Training RoBERTa is GPU-intensive and is recommended on a CUDA-compatible GPU (e.g. RTX 4060).
python backend/train_roberta.py