IrfanSDU's picture
Update app.py
9b84ace verified
raw
history blame contribute delete
476 Bytes
from transformers import pipeline
import gradio as gr
classifier = pipeline("sentiment-analysis")
#backend function which handles task
def score_text(text):
result = classifier(text)[0]
label = result["label"]
score = result["score"]
return f"Sentiment {label} score: {score}"
app = gr.Interface(
fn=score_text,
inputs=["textbox"],
outputs=["textbox"],
title="Sentiment Analysis App",
description="Description of the app"
)
app.launch()