Tirath5504 commited on
Commit
3fe2828
1 Parent(s): 63b3b22

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
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()