jjpwong's picture
Update app.py
daa8b2d
raw
history blame contribute delete
675 Bytes
import gradio as gr
from transformers import pipeline
sentiment = pipeline("sentiment-analysis")
def get_sentiment(input_text):
result = sentiment(input_text)
labels = [item['label'] for item in result]
scores = [item['score'] for item in result]
return labels, scores
demo = gr.Interface(
fn=get_sentiment,
inputs="text",
outputs=[gr.Textbox(label="Label"), gr.Textbox(label="Score")],
title = 'Sentiment Analysis Demo (ζƒ…η·’εˆ†ζžη€Ίη―„)',
description = "Analyze the sentiment based on given input (positive or negative) ζƒ…η·’εˆ†ζž",
examples=[["I love Computational Chemistry."], ["This movie is terrible."]],
)
demo.launch()