File size: 1,197 Bytes
16d1326 4e1c286 16d1326 4e1c286 |
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 53 54 55 56 57 |
---
license: mit
language:
- en
pipeline_tag: text-classification
tags:
- code
---
# Emotion classification from 20 classes
## 20 Emotion labels
| id | label |
| --- | ---------- |
| 0 | anger |
| 1 | cheeky |
| 2 | confuse |
| 3 | curious |
| 4 | disgust |
| 5 | empathetic |
| 6 | energetic |
| 7 | fear |
| 8 | grumpy |
| 9 | guilty |
| 10 | impatient |
| 11 | joy |
| 12 | love |
| 13 | neutral |
| 14 | sadness |
| 15 | serious |
| 16 | surprise |
| 17 | suspicious |
| 18 | think |
| 19 | whiny |
## How to use
Here is how to use this model to get the emotion label of a given text:
```python
from transformers import AutoModelForSequenceClassification, pipeline
model_name = 'jitesh/emotion-english'
model = AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = pipeline("text-classification", model=model, tokenizer=model_name)
text = "I can't wait any longer "
prediction = classifier(text)
print(prediction[0], text)
```
The above code outputs the following line.
```bash
{'label': 'impatient', 'score': 0.924211859703064} I can't wait any longer
``` |