File size: 511 Bytes
0ff342f
498ecea
 
0ff342f
 
 
498ecea
 
0ff342f
498ecea
0ff342f
498ecea
0ff342f
 
 
498ecea
0ff342f
498ecea
 
0ff342f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from transformers import pipeline
import gradio as gr

# Load the sentiment-analysis pipeline
sentiment_pipeline = pipeline("tabularisai/multilingual-sentiment-analysis")

def analyze_sentiment(text):
    result = sentiment_pipeline(text)
    return result[0]

# Create a Gradio interface
iface = gr.Interface(
    fn=analyze_sentiment, 
    inputs="text", 
    outputs="text", 
    title="Sentiment Analysis",
    description="Enter some text to analyze its sentiment."
)

# Launch the interface
iface.launch()