File size: 383 Bytes
a4368f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57d1846
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Filename: sentiment_app.py

import gradio as gr
from transformers import pipeline

classifier = pipeline("sentiment-analysis")

def analyze_sentiment(text):
    return classifier(text)[0]['label']

gr.Interface(
    fn=analyze_sentiment,
    inputs=gr.Textbox(label="Enter Text"),
    outputs=gr.Textbox(label="Sentiment"),
    title="📝 Sentiment Analyzer"
).launch(share=True)