Spaces:
Sleeping
Sleeping
File size: 460 Bytes
4cb4ffd 9446bb9 4cb4ffd 9446bb9 7b64d8b 3c2ea67 9446bb9 80e17cb 65b16f5 80e17cb 9446bb9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from transformers import pipeline
import gradio as gr
pipe = pipeline("sentiment-analysis")
def get_sentiment(input):
prediction = pipe(input)
label = prediction[0]['label']
score = prediction[0]['score']
return f'{label} {score * 100:.2f}%'
demo = gr.Interface(
fn=get_sentiment,
inputs="text",
outputs="text",
title="Sentiment Analysis",
description="Get a sentimental analysis for the provided text"
)
demo.launch() |