khadija3818's picture
Update app.py
1ac13d6
raw
history blame contribute delete
550 Bytes
import gradio as gr
from transformers import pipeline
# Load the sentiment analysis model
sentiment = pipeline("sentiment-analysis")
def get_sentiment(input_text):
result = sentiment(input_text)
label = result[0]['label']
score = result[0]['score']
return f"Sentiment: {label}, Score: {score:.4f}"
iface = gr.Interface(
fn=get_sentiment,
inputs="text",
outputs="text",
title="Sentiment Analysis with Transformers",
description="Analyze sentiment (negative/positive) of input text."
)
iface.launch(inline=False)