GDavila commited on
Commit
9baf9b9
1 Parent(s): 45f4eaa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from textblob import TextBlob
3
+
4
+ st.write("This is a basic sentiment analysis demo using textblob. It will take your input and assign a polarity score between -1.0 (negative sentiment) and +1.0 (positive sentiment). Subjectivity is given a score between 0.0 and 1.0 where 0.0 is very objective and 1.0 is very subjective. Textblob has the advantage of being relatively decent at sentiment analysis while fast and cheap compared to modern techniques. ")
5
+
6
+ x = st.text_input('Enter some text to be analyzed:')
7
+
8
+
9
+
10
+ if st.button('Analyze your input'):
11
+ testimonial = TextBlob( x )
12
+ polarity_score = testimonial.sentiment.polarity
13
+ subjectivity_score = testimonial.sentiment.subjectivity
14
+
15
+ st.write("Sentiment polarity: ", str(polarity_score) , " Subjectivity: ", str(subjectivity_score) )