import gradio as gr from transformers import pipeline # Load a pre-trained sentiment analysis model classifier = pipeline("sentiment-analysis") # Define the function to process user input def analyze_sentiment(text): result = classifier(text)[0] return f"Label: {result['label']}, Confidence: {result['score']:.2f}" # Create Gradio Interface interface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text") # Run the app locally interface.launch()