Update README.md
Browse files
README.md
CHANGED
|
@@ -1,36 +1,7 @@
|
|
| 1 |
-
%%writefile README.md
|
| 2 |
---
|
| 3 |
-
language: en
|
| 4 |
-
tags:
|
| 5 |
-
- text-classification
|
| 6 |
-
- emotions
|
| 7 |
-
- sentiment-analysis
|
| 8 |
datasets:
|
| 9 |
- AiLab-IMCS-UL/twitter_emotions-en
|
| 10 |
-
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
---
|
| 15 |
-
|
| 16 |
-
# Emotion Classification Model
|
| 17 |
-
|
| 18 |
-
This model classifies text into 6 emotions: sadness, joy, love, anger, fear, surprise.
|
| 19 |
-
|
| 20 |
-
## Usage
|
| 21 |
-
```python
|
| 22 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 23 |
-
import torch
|
| 24 |
-
|
| 25 |
-
tokenizer = AutoTokenizer.from_pretrained("your-username/emotion-classifier")
|
| 26 |
-
model = AutoModelForSequenceClassification.from_pretrained("your-username/emotion-classifier")
|
| 27 |
-
|
| 28 |
-
text = "I'm so happy!"
|
| 29 |
-
inputs = tokenizer(text, return_tensors="pt")
|
| 30 |
-
outputs = model(**inputs)
|
| 31 |
-
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 32 |
-
predicted_class = torch.argmax(predictions).item()
|
| 33 |
-
|
| 34 |
-
emotions = ['sadness', 'joy', 'love', 'anger', 'fear', 'surprise']
|
| 35 |
-
print(f"Emotion: {emotions[predicted_class]}")
|
| 36 |
-
```
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
datasets:
|
| 3 |
- AiLab-IMCS-UL/twitter_emotions-en
|
| 4 |
+
base_model:
|
| 5 |
+
- distilbert/distilbert-base-uncased
|
| 6 |
+
pipeline_tag: text-classification
|
| 7 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|