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 |
Here is how to use this model to get the emotion label of a given text:
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.
{'label': 'impatient', 'score': 0.924211859703064} I can't wait any longer