thak123's picture
Create app.py
e710478
raw
history blame
483 Bytes
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)