Spaces:
Running
Running
File size: 834 Bytes
dc80c20 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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() |