File size: 413 Bytes
4cb4ffd
9446bb9
4cb4ffd
 
 
9446bb9
65b16f5
 
9446bb9
80e17cb
 
 
65b16f5
80e17cb
 
 
 
9446bb9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import pipeline
import gradio as gr

pipe = pipeline("sentiment-analysis")

def get_sentiment(input):
    prediction = pipe(input)
    return f'{prediction[0].label} {prediction[0].score * 100}'

demo = gr.Interface(
    fn=get_sentiment, 
    inputs="text", 
    outputs="text",
    title="Sentiment Analysis",
    description="Get a sentimental analysis for the provided text"
)

demo.launch()