Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,57 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-classification
|
6 |
+
tags:
|
7 |
+
- code
|
8 |
---
|
9 |
+
|
10 |
+
# Emotion classification from 20 classes
|
11 |
+
|
12 |
+
## 20 Emotion labels
|
13 |
+
| id | label |
|
14 |
+
| --- | ---------- |
|
15 |
+
| 0 | anger |
|
16 |
+
| 1 | cheeky |
|
17 |
+
| 2 | confuse |
|
18 |
+
| 3 | curious |
|
19 |
+
| 4 | disgust |
|
20 |
+
| 5 | empathetic |
|
21 |
+
| 6 | energetic |
|
22 |
+
| 7 | fear |
|
23 |
+
| 8 | grumpy |
|
24 |
+
| 9 | guilty |
|
25 |
+
| 10 | impatient |
|
26 |
+
| 11 | joy |
|
27 |
+
| 12 | love |
|
28 |
+
| 13 | neutral |
|
29 |
+
| 14 | sadness |
|
30 |
+
| 15 | serious |
|
31 |
+
| 16 | surprise |
|
32 |
+
| 17 | suspicious |
|
33 |
+
| 18 | think |
|
34 |
+
| 19 | whiny |
|
35 |
+
|
36 |
+
|
37 |
+
## How to use
|
38 |
+
Here is how to use this model to get the emotion label of a given text:
|
39 |
+
|
40 |
+
|
41 |
+
```python
|
42 |
+
from transformers import AutoModelForSequenceClassification, pipeline
|
43 |
+
|
44 |
+
model_name = 'jitesh/emotion-english'
|
45 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
46 |
+
classifier = pipeline("text-classification", model=model, tokenizer=model_name)
|
47 |
+
|
48 |
+
text = "I can't wait any longer "
|
49 |
+
|
50 |
+
prediction = classifier(text)
|
51 |
+
print(prediction[0], text)
|
52 |
+
```
|
53 |
+
|
54 |
+
The above code outputs the following line.
|
55 |
+
```bash
|
56 |
+
{'label': 'impatient', 'score': 0.924211859703064} I can't wait any longer
|
57 |
+
```
|