Spaces:
Runtime error
Runtime error
johnowhitaker
commited on
Commit
•
1cf959e
1
Parent(s):
0b526cd
Update app.py
Browse files
app.py
CHANGED
@@ -86,12 +86,13 @@ with st.form("my_form"):
|
|
86 |
|
87 |
# Every form must have a submit button.
|
88 |
submitted = st.form_submit_button("Submit")
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
st.
|
|
|
|
86 |
|
87 |
# Every form must have a submit button.
|
88 |
submitted = st.form_submit_button("Submit")
|
89 |
+
|
90 |
+
if submitted:
|
91 |
+
st.write("Fetching user", user, "n_tweets", n_tweets)
|
92 |
+
tweets = get_tweets(user, limit=n_tweets)
|
93 |
+
st.write("Resulting dataframe shape:", tweets.shape)
|
94 |
+
st.write("Calculating sentiments...")
|
95 |
+
tweets['sentiment'] = tweets['tweet'].map(lambda s: combined_score(s))
|
96 |
+
st.write("Average sentiment:", tweets.sentiment.mean())
|
97 |
+
st.pyplot.hexbin(tweets['tweet_length'], tweets['sentiment']*1,
|
98 |
+
gridsize=20, bins=12, cmap='inferno')
|