File size: 228 Bytes
7ff1fe0
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
from transformers import pipeline

sentiment_obj = pipeline(task="sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")


def sentiment(text):
    # Returns sentiment value
    return sentiment_obj(text)