Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,33 +1,43 @@
|
|
| 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 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Emotion Classifier
|
| 3 |
+
emoji: 🎭
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: "1.32.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
# 🎭 Emotion Classifier — RoBERTa Based
|
| 12 |
+
A deep-learning model that classifies text into **five emotion categories**:
|
| 13 |
+
**anger, fear, joy, sadness, surprise**.
|
| 14 |
+
|
| 15 |
+
Built with **PyTorch, RoBERTa transformer, Streamlit UI** and deployed on **Hugging Face Spaces**.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## 🧠 Model Details
|
| 20 |
+
| Component | Description |
|
| 21 |
+
|-----------|-------------|
|
| 22 |
+
| Base model | `roberta-base` |
|
| 23 |
+
| Task | Single-label Emotion Classification |
|
| 24 |
+
| Input | Raw text |
|
| 25 |
+
| Output | Softmax probability distribution (5 emotions) |
|
| 26 |
+
| Framework | PyTorch + Transformers |
|
| 27 |
+
|
| 28 |
+
### Load Model from Hugging Face
|
| 29 |
+
```python
|
| 30 |
+
from huggingface_hub import hf_hub_download
|
| 31 |
+
import torch
|
| 32 |
+
from BertEmotionClassifier import BertEmotionClassifier
|
| 33 |
+
|
| 34 |
+
model_path = hf_hub_download(repo_id="aadhi3/RoBert_Model", filename="model.pth")
|
| 35 |
+
|
| 36 |
+
from transformers import AutoTokenizer
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained("roberta-base")
|
| 38 |
+
|
| 39 |
+
model = BertEmotionClassifier(model_name="roberta-base", num_labels=5)
|
| 40 |
+
state_dict = torch.load(model_path, map_location="cpu")
|
| 41 |
+
model.load_state_dict(state_dict)
|
| 42 |
+
model.eval()
|
| 43 |
```
|