import gradio as gr from transformers import pipeline # Load the pre-trained sentiment analysis model sentiment_analysis = pipeline(model="siebert/sentiment-roberta-large-english") # Define the function for sentiment prediction def predict_sentiment(text): result = sentiment_analysis(text) return result[0]['label'] # Create the Gradio interface iface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text", title="Sentiment Analyser", description="Here's a demo SA.",) # Launch the app iface.launch(share=True)