Welcome to the Emotion Detector Web App! This project is a user-friendly web application that detects emotions from text using a machine learning model trained on the GoEmotions dataset. Whether you're building a chatbot, analyzing social media, or just curious about NLP, this project is for you! π
- Detects a wide range of emotions from text
- Beautiful and interactive web interface (Streamlit)
- Preprocessing, training, and evaluation scripts included
- Uses scikit-learn for easy customization
- Ready-to-use trained model
GALLERY/
βββ app.py # Streamlit web app for emotion detection
βββ train.py # Training and evaluation script
βββ model.py # Model pipeline definition
βββ preprocess.py # Text cleaning utilities
βββ goemotions/ # Dataset and label files
β βββ train.tsv
β βββ test.tsv
β βββ dev.tsv
β βββ emotions.txt
β βββ ekman_mapping.json
βββ emotion_model.pkl # Saved trained model
βββ emotion.txt # (Optional) Additional emotion info
βββ README.md # Project documentation
-
Clone the repository
git clone https://github.com/nithins7676/emotion-classification.git cd emotion-classification -
Install dependencies
pip install streamlit scikit-learn pandas numpy joblib
-
Train the model (if not already trained)
python train.py
This will preprocess the data, train the model, and save it as
emotion_model.pkl. -
Run the web app
streamlit run app.py
Then open your browser and go to the local URL shown in the terminal (usually http://localhost:8501).
from joblib import load
model = load('emotion_model.pkl')
text = ["I am so happy to see you!"]
pred = model.predict(text)
print(f"Predicted emotion: {pred[0]}")- Based on the GoEmotions dataset
- Contains 27 emotion labels + neutral
Pull requests are welcome! For major changes, please open an issue first.
For questions, open an issue or contact the maintainer.
Made with β€οΈ, Streamlit, and Python π