File size: 1,204 Bytes
237a0f4
 
 
 
 
 
4a03f67
237a0f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed035ae
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
---
title: Emotion Classifier
emoji: 🎭
colorFrom: indigo
colorTo: blue
sdk: streamlit
sdk_version: 1.51.0
app_file: app.py
pinned: false
---
# 🎭 Emotion Classifier — RoBERTa Based
A deep-learning model that classifies text into **five emotion categories**:
**anger, fear, joy, sadness, surprise**.

Built with **PyTorch, RoBERTa transformer, Streamlit UI** and deployed on **Hugging Face Spaces**.

---

## 🧠 Model Details
| Component | Description |
|-----------|-------------|
| Base model | `roberta-base` |
| Task | Single-label Emotion Classification |
| Input | Raw text |
| Output | Softmax probability distribution (5 emotions) |
| Framework | PyTorch + Transformers |

### Load Model from Hugging Face
```python
from huggingface_hub import hf_hub_download
import torch
from BertEmotionClassifier import BertEmotionClassifier

model_path = hf_hub_download(repo_id="aadhi3/RoBert_Model", filename="model.pth")

from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("roberta-base")

model = BertEmotionClassifier(model_name="roberta-base", num_labels=5)
state_dict = torch.load(model_path, map_location="cpu")
model.load_state_dict(state_dict)
model.eval()
```