lab 6
from transformers import pipeline
sentiment = pipeline("sentiment-analysis")
sentences = [
"I love this product! It works perfectly.",
"This is the worst experience I've ever had.",
"The weather is nice today."
]
results = sentiment(sentences)
for s, r in zip(sentences, results):
print(f"{s} -> {r['label']} ({r['score']:.2f})")
Comments
Post a Comment