π BERT-Emotions Emotion Classifier
π― Overview
A lightweight, Emotions-powered emotion classification model fine-tuned for short text sentiment/emotion detection using BERT architecture.
Each input text is tagged with one of 13 rich emotional categories, mapped to expressive emotions π. This model is ideal for chatbot understanding, social media sentiment, and mental health analysis based on short messages.
π« Supported Emotions
Emotion | Emoji |
---|---|
Sadness | π’ |
Anger | π |
Love | β€οΈ |
Surprise | π² |
Fear | π± |
Happiness | π |
Neutral | π |
Disgust | π€’ |
Shame | π |
Guilt | π |
Confusion | π |
Desire | π₯ |
Sarcasm | π |
π Use Cases
- π§ Chatbot emotion understanding
- π Social media sentiment tagging
- π Mental health context detection
- π¬ Smart replies and reactions
- π Emotional tone analysis in text
π οΈ Usage
π Basic Inference Example
A minimal example to predict the emotion behind a simple sentence.
from transformers import pipeline
# Load the fine-tuned BERT Mini sentiment analysis model
sentiment_analysis = pipeline("text-classification", model="boltuix/bert-emotions")
# Analyze sentiment
result = sentiment_analysis("i love you")
print(result)
β Output
[{'label': 'love', 'score': 0.8442274928092957}]
This means the model predicts the emotion as Love β€οΈ with 84.42% confidence.
π Extended Example with Emoji Mapping
An enhanced version to map model output to human-readable emotion with emojis.
from transformers import pipeline
# Load the fine-tuned BERT-Emotions model
sentiment_analysis = pipeline("text-classification", model="boltuix/bert-emotion")
# Define label-to-emoji mapping
label_to_emoji = {
"Sadness": "π’",
"Anger": "π ",
"Love": "β€οΈ",
"Surprise": "π²",
"Fear": "π±",
"Happiness": "π",
"Neutral": "π",
"Disgust": "π€’",
"Shame": "π",
"Guilt": "π",
"Confusion": "π",
"Desire": "π₯",
"Sarcasm": "π"
}
# Input text
text = "i love you"
# Analyze emotion
result = sentiment_analysis(text)[0]
label = result["label"].capitalize()
emoji = label_to_emoji.get(label, "β")
# Output
print(f"Text: {text}")
print(f"Predicted Emotion: {label} {emoji}")
print(f"Confidence: {result['score']:.2%}")
β Output
Text: i love you
Predicted Emotion: Love β€οΈ
Confidence: 84.42%
This version enhances readability and gives an expressive emoji for the predicted emotion.
βοΈ Model Details
- π§ Base: BERT (uncased)
- π’ Classes: 13 emotions
- π£οΈ Language: English
- π·οΈ Output: Single-label classification
- π§ͺ Evaluation: Accuracy, F1, Precision, Recall
π¦ Model Card Info
- Name: BERT-Emotions
- Author: Boltuix
- License: Apache-2.0
- Version: v1.0
- Tags: emotion, emoji, emotions, text-classification
- Status: Public + Inference-ready
βοΈ Contact
- π¬ [email protected]
- Downloads last month
- 68
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support