from transformers import pipeline import gradio as gr

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

def predict_sentiment(text): result = classifier(text)

label = result[0]["label"]
score = result[0]["score"]

return f"{label} ({score:.2f})"

app = gr.Interface( fn=predict_sentiment, inputs="text", outputs="text", title="Sentiment Analysis using Hugging Face" )

app.launch()

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support