Sathiyapramod's picture
Update app.py
2c21bdb verified
raw
history blame contribute delete
580 Bytes
import gradio as gr
from transformers import pipeline
classifiers = pipeline(
"text-classification",
model="distilbert/distilbert-base-uncased-finetuned-sst-2-english",
)
def predict_my_sentiment(name):
prediction = classifiers(name)[0]
label = prediction['label']
score = prediction['score']
return label,score
demo = gr.Interface(
fn=predict_my_sentiment,
inputs=gr.Textbox(label="Type Your Current mindset !!!"),
outputs=[
gr.Textbox(label="Sentiment Label"),
gr.Number(label="Confidence Score")
]
)
demo.launch()