This project aims to predict the emotion conveyed in a given text using a deep learning model. The model is trained on a dataset containing 400,000 text samples labeled with six emotions: sad, anger, surprise, love, joy, and fear.
- Python
- NLTK
- TensorFlow
- Flask
- Data Collection: The data used for this project is taken from Kaggle.
- Data Preprocessing: Many preprocessing steps are applied on the data to prepare it for training.
- Model Architecture:
- Built a deep learning model having an
Embedding layer
followed by 4Bidirectional GRU
layers having 2M parameters. Dropout
andBatchNormalization
layers were also used to prevent overfitting and for regularization.- In the last
Flatten
layer followed by twoFC
(FullyConnected) layers were used to get the prediction
- Built a deep learning model having an
- Training: Trained the model on the prepared data and used techniques like
learning rate scheduling
andearly stopping
. - Evaluation: Evaluated the model's performance on a separate validation set and achieved 94% accuracy.
- Deployment: Deployd the trained model as a web app using
Flask
. - Usage: Use the web application to input text and predict the corresponding emotion.
- Cleaning Text: Remove any unwanted words from the text(eg. stopwords).
- Tokenization: Convert text into tokens for model input.
- Padding: Padd the text to have a same length for every inputs.
- Deep Learning: Use a deep learning model for emotion prediction.
- Flask: Build a web application for interacting with the model.
- Trained a deep learning model to predict emotions in text.
- Deployed the model as a web application for easy usage.
- This model can be used in various applications such as sentiment analysis in customer reviews, emotion detection in social media posts, and personal assistant applications to understand user emotions.
- Install the required dependencies using
pip install -r requirements.txt
. - Download the pre-trained model weights and place them in the
models/
directory. - Run the Flask web application using
python app.py
. - Access the application in your web browser at
http://localhost:5000
.