import gradio as gr | |
from transformers import pipeline | |
sentiment = pipeline("sentiment-analysis") | |
def get_sentiment(input_text): | |
result=sentiment(input_text) | |
for d in result: | |
return d['label'] | |
interface = gr.Interface(fn =get_sentiment, | |
inputs = 'text', | |
outputs = ['text'], | |
title= 'Sentiment Analysis', | |
theme = gr.themes.Glass(), | |
css = """" | |
body {background-color: #FFCCCB}""" | |
) | |
interface.launch() |