This repository contains the backend api in flask for fetching the tweets for a certain keyword or hashtag from twitter api and then using a saved LSTM model that I trained to classify tweets into 7 emotion categories namely: anger, disgust, fear, sadness, joy, neutral and surprise.
The model obtained accuracy of 73% by fine tuning bert model and accuracy of 63% by training LSTM model. The training was performed on GoEmotions dataset.
After cloning the repository and entering the repository folder :-
- Create a virtual environment using the command
python3 -m venv env
- Enter the virtual environment
source env/bin/activate
- Export your Bearer Token for twitter api
export BEARER_TOKEN = "********************"
- Install the dependencies
pip3 install -m requirements.txt
- Run the app
flask run
The frontend for the project is written in React and is in the repository :- https://github.com/msknkh/twitter-emotion-frontend