hongbo-miao/hongbomiao.com

View on GitHub
machine-learning/hugging-face/analyze-sentiment/src/main.py

Summary

Maintainability
A
0 mins
Test Coverage
import logging

from transformers import pipeline


def main() -> None:
    classifier = pipeline("sentiment-analysis")
    logging.info(classifier("I've been waiting for this course my whole life."))
    logging.info(classifier("I've been waiting for so long for this package to ship."))


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    main()