Update README.md
Browse files
README.md
CHANGED
@@ -4,6 +4,7 @@ tags:
|
|
4 |
model-index:
|
5 |
- name: twitter-roberta-base-emotion-multilabel-latest
|
6 |
results: []
|
|
|
7 |
---
|
8 |
|
9 |
<!-- This model card has been generated automatically according to the information Keras had access to. You should
|
@@ -33,13 +34,53 @@ pip install tweetnlp
|
|
33 |
Load the model in python.
|
34 |
```python
|
35 |
import tweetnlp
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
```
|
38 |
#### 2. pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
|
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
model-index:
|
5 |
- name: twitter-roberta-base-emotion-multilabel-latest
|
6 |
results: []
|
7 |
+
pipeline_tag: text-classification
|
8 |
---
|
9 |
|
10 |
<!-- This model card has been generated automatically according to the information Keras had access to. You should
|
|
|
34 |
Load the model in python.
|
35 |
```python
|
36 |
import tweetnlp
|
37 |
+
|
38 |
+
model = tweetnlp.load_model('topic_classification', model_name='cardiffnlp/twitter-roberta-base-emotion-multilabel-latest')
|
39 |
+
|
40 |
+
model.predict("I am so happy and sad at the same time")
|
41 |
+
|
42 |
+
>> {'label': ['joy', 'sadness']}
|
43 |
+
|
44 |
```
|
45 |
#### 2. pipeline
|
46 |
+
```shell
|
47 |
+
pip install -U tensorflow==2.10
|
48 |
+
```
|
49 |
+
|
50 |
+
```python
|
51 |
+
from transformers import pipeline
|
52 |
|
53 |
+
pipe = pipeline("text-classification", model="cardiffnlp/twitter-roberta-base-emotion-multilabel-latest", return_all_scores=True)
|
54 |
|
55 |
+
pipe("I am so happy and sad at the same time")
|
56 |
|
57 |
+
>> [[{'label': 'anger', 'score': 0.0059011634439229965},
|
58 |
+
{'label': 'anticipation', 'score': 0.024502484127879143},
|
59 |
+
{'label': 'disgust', 'score': 0.016748998314142227},
|
60 |
+
{'label': 'fear', 'score': 0.20184014737606049},
|
61 |
+
{'label': 'joy', 'score': 0.9260002970695496},
|
62 |
+
{'label': 'love', 'score': 0.13167349994182587},
|
63 |
+
{'label': 'optimism', 'score': 0.32711178064346313},
|
64 |
+
{'label': 'pessimism', 'score': 0.08952841907739639},
|
65 |
+
{'label': 'sadness', 'score': 0.8542942404747009},
|
66 |
+
{'label': 'surprise', 'score': 0.059213291853666306},
|
67 |
+
{'label': 'trust', 'score': 0.01618659868836403}]]
|
68 |
+
|
69 |
+
```
|
70 |
|
71 |
|
72 |
+
### Reference
|
73 |
+
```
|
74 |
+
@inproceedings{camacho-collados-etal-2022-tweetnlp,
|
75 |
+
title={{T}weet{NLP}: {C}utting-{E}dge {N}atural {L}anguage {P}rocessing for {S}ocial {M}edia},
|
76 |
+
author={Camacho-Collados, Jose and Rezaee, Kiamehr and Riahi, Talayeh and Ushio, Asahi and Loureiro, Daniel and Antypas, Dimosthenis and Boisson, Joanne and Espinosa-Anke, Luis and Liu, Fangyu and Mart{\'\i}nez-C{\'a}mara, Eugenio and others},
|
77 |
+
author = "Ushio, Asahi and
|
78 |
+
Camacho-Collados, Jose",
|
79 |
+
booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
|
80 |
+
month = nov,
|
81 |
+
year = "2022",
|
82 |
+
address = "Abu Dhabi, U.A.E.",
|
83 |
+
publisher = "Association for Computational Linguistics",
|
84 |
+
}
|
85 |
+
|
86 |
+
```
|