batharun2 commited on
Commit
dc80c20
·
verified ·
1 Parent(s): 587025d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def analyze_sentiment(text):
4
+ """Simple sentiment analysis for testing."""
5
+ if not text.strip():
6
+ return "Please enter some text to analyze."
7
+
8
+ text_lower = text.lower()
9
+
10
+ # Simple keyword-based analysis
11
+ if any(word in text_lower for word in ['love', 'awesome', 'great', 'amazing', 'excellent']):
12
+ return "**Sentiment:** Positive\n**Confidence:** 85%"
13
+ elif any(word in text_lower for word in ['hate', 'terrible', 'awful', 'bad', 'horrible']):
14
+ return "**Sentiment:** Negative\n**Confidence:** 85%"
15
+ else:
16
+ return "**Sentiment:** Neutral\n**Confidence:** 70%"
17
+
18
+ demo = gr.Interface(
19
+ fn=analyze_sentiment,
20
+ inputs="text",
21
+ outputs="markdown",
22
+ title="Sentiment Analysis",
23
+ description="Simple sentiment analysis for testing"
24
+ )
25
+
26
+ demo.launch()