sentiment / app.py
ananthujay's picture
Update app.py
b33fae6
raw
history blame
343 Bytes
import gradio as gr
from transformers import pipeline
nlp = pipeline("sentiment-analysis")
def scoring(text):
results = nlp(text)
sentiment = results[0]['label'] # Get the sentiment label (e.g., 'LABEL_1' or 'LABEL_2')
score = results[0]['score'] # Get the sentiment score
return f"Sentiment: {sentiment}, Score: {score}"