Spaces:
Sleeping
Sleeping
Tirath5504
commited on
Commit
•
3fe2828
1
Parent(s):
63b3b22
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from textblob import TextBlob
|
3 |
+
|
4 |
+
def analyze_sentiment(text):
|
5 |
+
blob = TextBlob(text)
|
6 |
+
return {"polarity": blob.sentiment.polarity, "subjectivity": blob.sentiment.subjectivity}
|
7 |
+
|
8 |
+
iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs=["json"], live=True)
|
9 |
+
iface.launch()
|