Sahar7888's picture
Update app.py
aa4fc13 verified
raw
history blame contribute delete
874 Bytes
##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()