sentimental / app.py
sbicy's picture
Create app.py
f0967d5 verified
raw
history blame
511 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline('sentiment-analysis')
def sentiment_analysis(text):
result = classifier(text)[0]
return f"Label: {result['label']}, Score: {round(result['score'], 4)}"
iface = gr.Interface(
fn=sentiment_analysis,
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter text here..."),
outputs="text",
title="Simple Sentiment Analysis",
description="Enter a sentence and see if it's Positive or Negative!"
)
iface.launch()