Spaces:
Sleeping
Sleeping
| ##Package | |
| import torch | |
| from transformers import pipeline | |
| import gradio as gr | |
| pipe_new = pipeline(task="text-classification", | |
| model="nlptown/bert-base-multilingual-uncased-sentiment") | |
| def sentiment_score(text): | |
| return pipe_new(text)[0]['label'] | |
| # Create title, description and article strings | |
| title = "Sentiment Analysis" | |
| description = "This model predicts the sentiment of the review as a number of stars (between 1 and 5) using nlptown/bert-base-multilingual-uncased-sentiment model" | |
| # article = "This model predicts the sentiment of the review as a number of stars (between 1 and 5) using nlptown/bert-base-multilingual-uncased-sentiment model" | |
| demo = gr.Interface(fn=sentiment_score, | |
| inputs="text", | |
| outputs="text", | |
| title=title, | |
| description=description) | |
| # Launch the app! | |
| demo.launch() | |