Spaces:
Sleeping
Sleeping
File size: 513 Bytes
bf45225 5489a32 bf45225 5489a32 bf45225 5489a32 bf45225 5489a32 bf45225 5489a32 bf45225 5489a32 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import gradio as gr
from transformers import pipeline
# Initialize the sentiment analysis pipeline
sentiment_pipeline = pipeline("sentiment-analysis")
def get_sentiment(input_text):
result = sentiment_pipeline(input_text) # fixed typo
return result[0]['label']
# Launch the web UI
iface = gr.Interface(
fn=get_sentiment,
inputs='text',
outputs='text',
title="My First AI App",
description="Enter some text and I will tell you whether it is positive or negative"
)
iface.launch()
|