diff --git a/README.md b/README.md index 6eefd16..1ed0e9a 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,23 @@ a) Run emotion model with 3 lines of code on single text example using Hugging F [![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) +```python +from transformers import pipeline +classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", return_all_scores=True) +classifier("I love this!") +``` + +```python +Output: +[[{'label': 'anger', 'score': 0.004419783595949411}, + {'label': 'disgust', 'score': 0.0016119900392368436}, + {'label': 'fear', 'score': 0.0004138521908316761}, + {'label': 'joy', 'score': 0.9771687984466553}, + {'label': 'neutral', 'score': 0.005764586851000786}, + {'label': 'sadness', 'score': 0.002092392183840275}, + {'label': 'surprise', 'score': 0.008528684265911579}]] +``` + b) Run emotion model on multiple examples and full datasets (e.g., .csv files) on Google Colab: [![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)