This is a Machine Learning-based web application built with Streamlit that detects whether a piece of news is Real or Fake. The app uses multiple ML models for prediction and provides visual insights like confusion matrices.
- Predicts news as Real or Fake using multiple models:
- Logistic Regression
- Decision Tree
- Gradient Boosting
- Random Forest
- Displays accuracy, confusion matrix, and classification report for each model
- Decision Tree visualization for interpretability
- User-friendly interface built with Streamlit
- Clone this repository:
git clone <repository_url>
cd <repository_folder>- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the Streamlit app:
streamlit run app.py-
Open the local URL shown in the terminal (usually
http://localhost:8501) -
Paste your news text in the text area and click Predict
-
The app will display predictions from all models and a majority-vote final verdict
app.py— Main Streamlit applicationvectorizer.joblib— Saved TF-IDF vectorizerlogistic_regression_model.joblib— Trained Logistic Regression modeldecision_tree_model.joblib— Trained Decision Tree modelgradient_boosting_model.joblib— Trained Gradient Boosting modelrandom_forest_model.joblib— Trained Random Forest model
The models are trained on a labeled dataset of news articles. The dataset contains text samples classified as either real or fake news.
- Python — Core programming language
- Streamlit — Web app framework
- scikit-learn — Machine learning models and preprocessing
- joblib — Model serialization
- pandas — Data manipulation
- matplotlib/seaborn — Visualization
Note: Make sure you have the trained model files (.joblib) in your project directory before running the app.