import gradio as gr | |
from transformers import pipeline | |
sentiment = pipeline("sentiment-analysis") | |
def get_sentiment(input_text): | |
return sentiment(input_text) | |
def format_model_output(output): | |
return f"I am {output['score']*100:.2f}% sure that the review is {output['label']}" | |
iface = gr.Interface(fn = get_sentiment, | |
inputs = "text", | |
outputs = ['text'], | |
title='RoBERTa Sentiment Analysis', | |
description = ''' "Creating safe AGI that benefits all of humanity" ''') | |
iface.launch(inline = False) | |