| # Fake News Detection Project |
|
|
| ## Overview |
| This project is a Fake News Detection application built using Streamlit and TensorFlow. It leverages a pre-trained BERT model to classify news articles as real or fake. The application fetches real-life news from various sources, processes the data, and provides users with an intuitive interface to analyze the credibility of news headlines. |
|
|
| ## Project Structure |
| ``` |
| fake-news-streamlit |
| βββ app.py # Main entry point of the Streamlit application |
| βββ src # Source code for the application |
| β βββ news_fetcher.py # Functions to fetch real-life news |
| β βββ model_loader.py # Loads the pre-trained machine learning model |
| β βββ predictor.py # Prediction logic for classifying news |
| β βββ preprocess.py # Preprocessing functions for fetched news data |
| β βββ visualizer.py # Visualization of prediction results |
| β βββ utils.py # Utility functions used across the application |
| βββ models # Directory for model documentation |
| β βββ README.md # Documentation about the models used |
| βββ notebooks # Jupyter notebooks for exploration |
| β βββ exploration.ipynb # Notebook for exploratory data analysis |
| βββ tests # Unit tests for the application |
| β βββ test_predict.py # Tests for the prediction logic |
| βββ requirements.txt # Project dependencies |
| βββ Dockerfile # Instructions for building a Docker image |
| βββ .env.example # Example environment variables |
| βββ .gitignore # Files and directories to ignore by Git |
| βββ README.md # Project documentation |
| ``` |
|
|
| ## Setup Instructions |
| 1. **Clone the repository**: |
| ``` |
| git clone <repository-url> |
| cd fake-news-streamlit |
| ``` |
|
|
| 2. **Create a virtual environment** (optional but recommended): |
| ``` |
| python -m venv venv |
| source venv/bin/activate # On Windows use `venv\Scripts\activate` |
| ``` |
|
|
| 3. **Install dependencies**: |
| ``` |
| pip install -r requirements.txt |
| ``` |
|
|
| 4. **Set up environment variables**: |
| Copy `.env.example` to `.env` and fill in the required values. |
|
|
| 5. **Run the application**: |
| ``` |
| streamlit run app.py |
| ``` |
|
|
| ## Usage |
| - The application provides a dashboard for users to input news headlines and receive predictions on their credibility. |
| - Users can also upload CSV files for batch predictions. |
| - The sidebar contains controls for adjusting model parameters and viewing token importance. |
|
|
| ## Contributing |
| Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes. |
|
|
| ## License |
| This project is licensed under the MIT License. See the LICENSE file for more details. |