| from transformers import pipeline | |
| import gradio as gr | |
| sentiment = pipeline("sentiment-analysis") | |
| def get_sentiment(text): | |
| sent = sentiment(text)[0]['label'] | |
| score = sentiment(text)[0]['score'] | |
| return sent, score | |
| interface = gr.Interface(fn = get_sentiment, inputs=gr.Textbox(label="Enter the review"), outputs = [gr.Textbox(label = "Sentiment :"), gr.Textbox(label = "Score :")]) | |
| interface.launch() |