Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
pipe_classification = pipeline("text-classification", model="nlptown/bert-base-multilingual-uncased-sentiment") | |
# print(pipe_classification("i like this product")[0]) | |
def classification_fun(sentence): | |
result = pipe_classification(sentence)[0] | |
return result["label"] | |
custom_css = """ | |
body { | |
background: #E3F2FD; | |
} | |
""" | |
ex = [ | |
["I love this product! It's amazing!"], | |
["This was the worst experience I've ever had."], | |
["The movie was okay, not great but not bad either."], | |
["Absolutely fantastic! I would recommend it to everyone."] | |
] | |
intrface = gr.Interface( | |
fn=classification_fun, | |
inputs=gr.Textbox(label="Enter Your Sentence", lines=10), | |
outputs=gr.Textbox(label="predicted sentiment"), | |
examples=ex, | |
css=custom_css | |
) | |
intrface.launch() |