johnowhitaker commited on
Commit
1cf959e
1 Parent(s): 0b526cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
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
- if submitted:
90
- st.write("Fetching user", user, "n_tweets", n_tweets)
91
- tweets = get_tweets(user, limit=n_tweets)
92
- st.write("Resulting dataframe shape:", tweets.shape)
93
- st.write("Calculating sentiments...")
94
- tweets['sentiment'] = tweets['tweet'].map(lambda s: combined_score(s))
95
- st.write("Average sentiment:", tweets.sentiment.mean())
96
-
97
- st.write("Outside the form")
 
 
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')