j-hartmann commited on
Commit
5e453b0
1 Parent(s): 71b3fd2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -0
README.md CHANGED
@@ -36,6 +36,23 @@ a) Run emotion model with 3 lines of code on single text example using Hugging F
36
 
37
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/simple_emotion_pipeline.ipynb)
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  b) Run emotion model on multiple examples and full datasets (e.g., .csv files) on Google Colab:
40
 
41
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/emotion_prediction_example.ipynb)
 
36
 
37
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/simple_emotion_pipeline.ipynb)
38
 
39
+ ```python
40
+ from transformers import pipeline
41
+ classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", return_all_scores=True)
42
+ classifier("I love this!")
43
+ ```
44
+
45
+ ```python
46
+ Output:
47
+ [[{'label': 'anger', 'score': 0.004419783595949411},
48
+ {'label': 'disgust', 'score': 0.0016119900392368436},
49
+ {'label': 'fear', 'score': 0.0004138521908316761},
50
+ {'label': 'joy', 'score': 0.9771687984466553},
51
+ {'label': 'neutral', 'score': 0.005764586851000786},
52
+ {'label': 'sadness', 'score': 0.002092392183840275},
53
+ {'label': 'surprise', 'score': 0.008528684265911579}]]
54
+ ```
55
+
56
  b) Run emotion model on multiple examples and full datasets (e.g., .csv files) on Google Colab:
57
 
58
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/emotion_prediction_example.ipynb)