π https://fake-news-detector-ujjawal.streamlit.app
In todayβs digital world, misinformation spreads rapidly through social media and online platforms.
It becomes difficult for users to verify whether a news article is genuine or fake.
π This project aims to automatically detect fake news using Machine Learning and NLP techniques.
We built an AI-powered web application that:
- Analyzes news text
- Extracts content from URLs
- Classifies news as Real or Fake
- Provides a confidence score
- Shows trending real-world news
- π Text-based fake news detection
- π URL-based article analysis
- π Confidence score with progress bar
- π Article preview for better understanding
- π₯ Live trending news using GNews API
- π¨ Interactive and modern UI (Streamlit)
- Python
- Logistic Regression
- TF-IDF Vectorization
- Streamlit
- GNews API (for trending news)
- scikit-learn
- pandas
- numpy
- newspaper3k
- requests
fake_news_project/
β
βββ app/
β βββ app.py # Streamlit application
β
βββ data/
β βββ Fake.csv # Fake news dataset
β βββ True.csv # Real news dataset
β
βββ model/
β βββ model.pkl # Trained ML model
β βββ vectorizer.pkl # TF-IDF vectorizer
β
βββ main.py # Model training script
βββ requirements.txt # Dependencies
βββ README.md # Documentation
- Used two datasets:
- Fake News
- Real News
- Converted text to lowercase
- Removed special characters using regex
- Cleaned noise and unwanted symbols
- Applied TF-IDF Vectorizer
- Converted text into numerical vectors
- Used Logistic Regression
- Split dataset into training and testing
- Achieved high accuracy (~99%)
User input β Clean text β Transform (TF-IDF) β Model prediction
Output:
- Real / Fake
- Confidence score
- Uses
newspaper3klibrary - Extracts full article text automatically
- Applies same ML pipeline for prediction
- Integrated with GNews API
- Fetches real-time headlines
- Displays:
- Title
- Source
- Link
- Accuracy: ~99%
- Precision: High
- Recall: High
π Note: High accuracy is due to dataset characteristics.
- Model trained on specific dataset β may not generalize fully
- Cannot verify factual correctness (pattern-based prediction)
- Sensitive to writing style differences
- Use BERT / Transformers for better understanding
- Add explainability (why prediction is fake/real)
- Improve UI with dashboard design
- Add multilingual support
- Store prediction history
git clone https://github.com/your-username/fake-news-project.git
cd fake-news-project
pip install -r requirements.txt
streamlit run app/app.py
Deployed using Streamlit Community Cloud
Ujjawal Shrivastava
Aspiring Data Scientist
This project demonstrates how Machine Learning + NLP can be applied to solve real-world problems like fake news detection.
It showcases:
- End-to-end ML pipeline
- Real-time API integration
- Interactive UI development
- Cloud deployment