Update README.md
This commit is contained in:
parent
71b3fd2c6a
commit
5e453b0f6c
17
README.md
17
README.md
|
@ -36,6 +36,23 @@ a) Run emotion model with 3 lines of code on single text example using Hugging F
|
||||||
|
|
||||||
[](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/simple_emotion_pipeline.ipynb)
|
[](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:
|
b) Run emotion model on multiple examples and full datasets (e.g., .csv files) on Google Colab:
|
||||||
|
|
||||||
[](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/emotion_prediction_example.ipynb)
|
[](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/emotion_prediction_example.ipynb)
|
||||||
|
|
Loading…
Reference in New Issue