File size: 430 Bytes
fa8b239
 
 
f51bcc7
 
fa8b239
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline
sentiment_pipeline = pipeline("sentiment-analysis")
def get_sentiment(input_text):
    result = sentiment_pipeline(input_text)
    return result[0]['label']


#launch the Web UI
iface = gr.Interface(
    fn = get_sentiment,
    inputs = "text",
    outputs = "text",
    title = "First App",
    description = "Enter some text I'll tell positive or negative"
)
iface.launch()