prof-rossetti / intro-to-python

An Introduction to Programming in Python
Other
97 stars 244 forks source link

Hugging Face NLP Transformers #85

Open s2t2 opened 3 years ago

s2t2 commented 3 years ago

https://github.com/huggingface/transformers

https://huggingface.co/transformers/main_classes/pipelines.html?highlight=pipeline#transformers.pipeline

pip install transformers
from transformers import pipeline

classifier = pipeline('sentiment-analysis')
classifier
results = classifier('We are very happy to introduce pipeline to the transformers repository.')
print(results)
#> [{'label': 'POSITIVE', 'score': 0.9996980428695679}]