Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from textblob import TextBlob
|
3 |
+
|
4 |
+
def analyze(text):
|
5 |
+
blob = TextBlob(text)
|
6 |
+
polarity = blob.sentiment.polarity
|
7 |
+
sentiment = "Positive" if polarity > 0 else "Negative" if polarity < 0 else "Neutral"
|
8 |
+
return f"Sentiment: {sentiment} (Polarity: {polarity:.2f})"
|
9 |
+
|
10 |
+
iface = gr.Interface(fn=analyze, inputs="text", outputs="text")
|
11 |
+
iface.launch()
|