File size: 1,383 Bytes
8b6e13e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
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}")