Update README.md
Browse files
README.md
CHANGED
|
@@ -27,10 +27,12 @@ Here is how to use this model:
|
|
| 27 |
>>> from transformers import pipeline
|
| 28 |
>>> model_name = "roberta-large-emopillars-contextless-isear"
|
| 29 |
>>> threshold = 0.5
|
| 30 |
-
>>> emotions = [
|
| 31 |
-
>>>
|
| 32 |
-
>>>
|
| 33 |
-
>>>
|
|
|
|
|
|
|
| 34 |
>>> label_to_emotion = dict(zip(list(range(len(emotions))), emotions))
|
| 35 |
>>> emotion_to_isear = {
|
| 36 |
>>> "anger": "anger",
|
|
@@ -45,9 +47,11 @@ Here is how to use this model:
|
|
| 45 |
>>> pipe = pipeline("text-classification", model=model_name, truncation=True,
|
| 46 |
>>> return_all_scores=True, device=-1 if device.type=="cpu" else 0)
|
| 47 |
>>> # input in a format f"{text}"
|
| 48 |
-
>>> utterances = [
|
| 49 |
-
>>>
|
| 50 |
-
>>>
|
|
|
|
|
|
|
| 51 |
>>> outcome = pipe(utterances)
|
| 52 |
>>> dominant_classes = [
|
| 53 |
>>> [prediction for prediction in example if prediction['score'] >= threshold and
|
|
|
|
| 27 |
>>> from transformers import pipeline
|
| 28 |
>>> model_name = "roberta-large-emopillars-contextless-isear"
|
| 29 |
>>> threshold = 0.5
|
| 30 |
+
>>> emotions = [
|
| 31 |
+
>>> "admiration", "amusement", "anger", "annoyance", "approval", "caring", "confusion",
|
| 32 |
+
>>> "curiosity", "desire", "disappointment", "disapproval", "disgust", "embarrassment",
|
| 33 |
+
>>> "excitement", "fear", "gratitude", "grief", "joy", "love", "nervousness", "optimism",
|
| 34 |
+
>>> "pride", "realization", "relief", "remorse", "sadness", "surprise", "neutral"
|
| 35 |
+
>>> ]
|
| 36 |
>>> label_to_emotion = dict(zip(list(range(len(emotions))), emotions))
|
| 37 |
>>> emotion_to_isear = {
|
| 38 |
>>> "anger": "anger",
|
|
|
|
| 47 |
>>> pipe = pipeline("text-classification", model=model_name, truncation=True,
|
| 48 |
>>> return_all_scores=True, device=-1 if device.type=="cpu" else 0)
|
| 49 |
>>> # input in a format f"{text}"
|
| 50 |
+
>>> utterances = [
|
| 51 |
+
>>> "Ok is it just me or is anyone else getting goosebumps too???",
|
| 52 |
+
>>> "Don’t know what to do",
|
| 53 |
+
>>> "When a car is overtaking another and I am forced to drive off the road."
|
| 54 |
+
>>> ]
|
| 55 |
>>> outcome = pipe(utterances)
|
| 56 |
>>> dominant_classes = [
|
| 57 |
>>> [prediction for prediction in example if prediction['score'] >= threshold and
|