A modern web application leveraging deep learning to detect fake news from legitimate content with up to 90% accuracy.
preview.mp4

- Overview
- Features
- Tech Stack
- Project Structure
- Installation
- Usage
- API Documentation
- Model Architecture
- Performance
- Future Work
- Contributing
- License
This project implements a Fake News Detection System using a fine-tuned BERT architecture. The system analyzes news content and classifies it as either legitimate or fake news with high accuracy, helping users identify misinformation in digital content.
- High Accuracy Detection: Custom BERT model with 90% classification accuracy
- User-Friendly Interface: Modern React frontend
- API Integration: Well-documented FastAPI backend for easy integration
- Reproducible Research: Complete Jupyter notebook with model training process
- Model: Custom BERT architecture based on
bert-base-uncased
from Huggingface - Framework: FastAPI
- Language: Python 3.8+
- ML Libraries: PyTorch, Transformers, Scikit-learn
- Framework: React 18+ with Vite
- UI Components: Shadcn UI
- Styling: Tailwind CSS
- HTTP Client: Axios
- State Management: React Context API
- Version Control: Git
- Documentation: Jupyter Notebooks
- Package Management: npm, pip
fake-news-detection/
โโโ README.md # Project documentation
โโโ LICENSE # Project License
โโโ backend/ # FastAPI server
โ โโโ app.py # API entry point
โ โโโ model_download_helper.py # Script to automatically download model files from cloud storage
โ โโโ notebook/ # Jupyter Notebook
โ โโโ models/ # ML model definitions
โ โโโ requirements.txt # Python dependencies
โโโ images/ # Project Screenshots
โ โโโ screenshot.jpeg # UI Preview
โโโ frontend/ # Vite-React application
โโโ src/
โ โโโ components/ # UI components
โ โโโ pages/ # Application pages
โ โโโ ui/ # ShadCN UI
โ โโโ context/ # React Context for Manual Theme Switching
โ โโโ lib/ # TW Library
โ โโโ App.jsx # Application
โ โโโ App.css # Application CSS
โ โโโ index.css # Main CSS file
โ โโโ main.jsx # Main React Component
โโโ package.json # JS dependencies
โโโ tailwind.config.js # Tailwind configuration
- Python 3.8+
- Node.js 16+
- npm or yarn
- Git
git clone https://github.com/ItsTSH/Fake-News-Detection-System
cd fake-news-detection-system
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cd frontend
npm install # or yarn install
cd backend
uvicorn app.main:app --reload
cd frontend
npm run dev # or yarn dev
Access the application at http://localhost:5173
Endpoint | Method | Description |
---|---|---|
/predict |
POST | Submit text for fake news analysis |
The fake news detection model is based on the BERT base architecture from Huggingface with the following modifications:
- Pre-trained Base:
bert-base-uncased
from Huggingface - Layer Freezing: Most BERT layers are frozen during training for transfer learning efficiency
- Custom Classification Head: Additional layers for the specific task of fake news detection
- Hyperparameter Tuning: Optimized learning rate, batch size, and training epochs
For detailed architecture and training process, refer to the Jupyter notebook in the model/notebooks/
directory.
- Accuracy: upto 90% on test dataset
- F1 Score: 0.86
- Precision: 0.91
- Recall: 0.91
- Dataset Used: Kaggle: fake-and-real-news-dataset
- Support for multi-language fake news detection
- Support for news content along with the title
- Integration with browser extensions for real-time checking
- Explainable AI features to highlight suspicious text segments
- Model versioning and A/B testing infrastructure
- User feedback loop for continuous model improvement
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
โญ If you find this project helpful, please consider starring the repository! ๐
Made with โค๏ธ by Tejinder Singh Hunjan