Spaces:
Sleeping
Sleeping
File size: 575 Bytes
e0be1b6 83d0aae e0be1b6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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()
|