Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
classifier = pipeline("sentiment-analysis") | |
def score_text(text): | |
result = classifier(text)[0] | |
label = result["label"] | |
score = result["score"] | |
return f"Sentiment: {label}. Score: {score}." | |
app = gr.Interface( | |
fn=score_text, | |
inputs=["textbox"], | |
outputs=["textbox"], | |
title="Sentiment Analysis App π€πΆπ€", | |
description="Enter any text to analyse its sentiment using ML. The app returns whether the sentiment is Positive, Neutral, Negative with confidence score." | |
) | |
app.launch() | |