File size: 435 Bytes
2dabb60
 
 
 
 
 
 
 
 
 
 
3a2bb5e
 
 
2dabb60
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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']


iface = gr.Interface(
    fn = get_sentiment,
    inputs = "text", outputs = "text",
    title = "My first AI App",
    description = "Enter some text and I'll tell you whether it is positive or negative"
)
iface.launch()