File size: 392 Bytes
b46fba9 7d60ca9 b46fba9 7d60ca9 003a10c b46fba9 003a10c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import gradio as gr
from transformers import pipeline
def sentiment_analysis(text):
classifier = pipeline('sentiment-analysis')
result = classifier(text)
sentiment = result[0]['label']
score = result[0]['score']
return f"Sentiment: {sentiment} (Score: {score:.2f})"
interface = gr.Interface(fn=sentiment_analysis, inputs="text", outputs="text")
interface.launch() |