Spaces:
Sleeping
Sleeping
File size: 874 Bytes
cff67e1 7c61031 cff67e1 aa4fc13 cff67e1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ##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()
|