File size: 587 Bytes
f6364ae 4a04a3d f6364ae 4a04a3d dcf4bbc 4a04a3d 87375a2 b17ec8a 4a04a3d b17ec8a dcf4bbc 4a04a3d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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)
|