Spaces:
Sleeping
Sleeping
| 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() |