Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
sentiment = pipeline('sentiment-analysis',) | |
def get_sentiment(input_text): | |
result = sentiment(input_text) | |
return f"result: {result[0]['label']}", f"score: {result[0]['score']}" | |
interface = gr.Interface( | |
fn=get_sentiment, | |
inputs='text', | |
outputs=['text', 'text'], | |
title='Sentiment Analysis', | |
description='Get the positive/negative sentiment for the given input.' | |
) | |
interface.launch(inline = False) |