This project aims to build a Transformer Based Learning model for classifying fake news articles. We use FastAPI to serve the model as a web application.
- Python 3.x
- pip
- Virtual environment (optional but recommended)
To isolate the dependencies, it is recommended to create a virtual environment. Run the following command to create a new virtual environment in a directory named .venv
:
python -m venv .venv
Once the virtual environment is created, you need to activate it.
-
For macOS and Linux:
source .venv/bin/activate
-
For Windows:
.\.venv\Scripts\activate
After activating the virtual environment, install the required libraries by running:
pip install -r requirements.txt
Once the libraries are installed, execute train_transformer_distillbert_classification.py
to train your Deep Learning model. The model will be saved in Models Folder.
python train_transformer_distillbert_classification.py
After training the model, start the FastAPI application by running:
uvicorn main:app --reload
The FastAPI application will now be running and you can access it via http://127.0.0.1:8000/docs
.
Note: The sample size is currently limited to 1000 due to computational constraints.