import gradio as gr def analyze_sentiment(text): """Simple sentiment analysis for testing.""" if not text.strip(): return "Please enter some text to analyze." text_lower = text.lower() # Simple keyword-based analysis if any(word in text_lower for word in ['love', 'awesome', 'great', 'amazing', 'excellent']): return "**Sentiment:** Positive\n**Confidence:** 85%" elif any(word in text_lower for word in ['hate', 'terrible', 'awful', 'bad', 'horrible']): return "**Sentiment:** Negative\n**Confidence:** 85%" else: return "**Sentiment:** Neutral\n**Confidence:** 70%" demo = gr.Interface( fn=analyze_sentiment, inputs="text", outputs="markdown", title="Sentiment Analysis", description="Simple sentiment analysis for testing" ) demo.launch()