from transformers import pipeline import gradio as gr # Load sentiment analysis model sentiment_pipeline = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis") # Function for sentiment analysis def sentiment_analysis(text): result = sentiment_pipeline(text)[0] return f"Label: {result['label']}, Confidence: {round(result['score'], 4)}" # Gradio Interface demo = gr.Interface(fn=sentiment_analysis, inputs=gr.Textbox(label="Enter Text"), outputs=gr.Textbox(label="Sentiment Output"), title="Multilingual Sentiment Analysis") # Launch app locally demo.launch()