sentiment / app.py
hussain-shk's picture
new gr
48b0ee3
raw
history blame
651 Bytes
from transformers import pipeline
import gradio as gr
roberta_pipe = pipeline(
"sentiment-analysis",
model="siebert/sentiment-roberta-large-english",
tokenizer="siebert/sentiment-roberta-large-english",
return_all_scores = True
)
def analyse_sentiment(text):
response = roberta_pipe(text)
return response
text = gr.inputs.Textbox(lines=5, placeholder="Enter Text to Get Sentiment",default="", label="Enter Text")
text_output = gr.outputs.Textbox(type="auto", label=f"Sentiment")
iface = gr.Interface(fn=analyse_sentiment, inputs=[text], outputs=text_output, title='Roberta Sentiment Analysis')
iface.launch(enable_queue=True)