Instructions to use hrrbb/emotion-bert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hrrbb/emotion-bert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="hrrbb/emotion-bert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("hrrbb/emotion-bert") model = AutoModelForSequenceClassification.from_pretrained("hrrbb/emotion-bert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from hrrbb/emotion-bert: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/hrrbb/emotion-bert/resolve/main/README.md
- Command line
-
hf download hf://hrrbb/emotion-bert/README.md
-
curl -L -o README.md https://huggingface.co/hrrbb/emotion-bert/resolve/main/README.md
1.38 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| tags: | |
| - text-classification | |
| - emotion-classification | |
| - bert | |
| - transformers | |
| base_model: bert-base-uncased | |
| pipeline_tag: text-classification | |
| library_name: transformers | |
| # Emotion BERT – Islamic Guidance Emotion Classifier | |
| A fine-tuned BERT model for detecting emotions in English text, built as part of **RUHI** — an AI-powered Islamic guidance platform that recommends Quranic verses, Hadith, and Duas based on a user's emotional state. | |
| ## Emotion Classes | |
| | Label | Description | | |
| |-------|-------------| | |
| | `neutral` | No strong emotion | | |
| | `sadness` | Sorrow or unhappiness | | |
| | `fear_anxiety` | Fear, stress, or nervousness | | |
| | `happiness_gratitude` | Joy, thankfulness, contentment | | |
| | `anger` | Irritation or rage | | |
| | `regret_repentance` | Guilt or seeking forgiveness | | |
| ## Model Details | |
| - **Base model:** `bert-base-uncased` | |
| - **Task:** Multi-label emotion classification (6 labels) | |
| - **Framework:** Hugging Face Transformers (PyTorch) | |
| - **Input:** English text (max 128 tokens) | |
| - **Output:** Probability score for each emotion | |
| ## Usage | |
| ```python | |
| from transformers import pipeline | |
| classifier = pipeline( | |
| "text-classification", | |
| model="hrrbb/emotion-bert", | |
| top_k=None, | |
| function_to_apply="sigmoid" | |
| ) | |
| text = "I feel so lost and overwhelmed." | |
| for r in classifier(text): | |
| print(f"{r['label']}: {r['score']:.4f}") |