File size: 409 Bytes
3b85f52
fa18322
3b85f52
 
 
 
 
75ce8c3
3b85f52
 
 
 
 
 
 
 
 
75ce8c3
3b85f52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

model_name = "distilbert/distilbert-base-uncased-finetuned-sst-2-english"
sentiment_analysis = pipeline("text-classification", model=model_name)

def pipe(text):
    return "The entered sentence is:  " + str(sentiment_analysis (text)[0]["label"])+ "!"


    
demo = gr.Interface(
    fn=pipe,
    inputs=["text"],
    outputs=["text"],
)

demo.launch()