wilmerags commited on
Commit
61a29bd
1 Parent(s): 2d7af1c

feat: Add button to avoid wasting computation on number interaction and to improve readability of the app

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -92,12 +92,17 @@ with col1:
92
  tw_user = st.text_input("Twitter handle", "huggingface")
93
  with col2:
94
  tw_sample = st.number_input("Maximum number of tweets to use", 1, 300, 100, 10)
95
-
96
- expected_lang = st.radio(
97
- "What language should be assumed to be found?",
98
- ('English', 'Use all the ones you know (~15 lang)'),
99
- 0
100
- )
 
 
 
 
 
101
 
102
  with st.spinner(text="Loading model..."):
103
  model = load_model(model_to_use[expected_lang])
@@ -106,7 +111,7 @@ usr = client.get_user(username=tw_user)
106
 
107
  # st.write(usr.data.id)
108
 
109
- if tw_user:
110
  with st.spinner(f"Getting to know the '{tw_user}'..."):
111
  tweets_objs = []
112
  while tw_sample >= 100:
 
92
  tw_user = st.text_input("Twitter handle", "huggingface")
93
  with col2:
94
  tw_sample = st.number_input("Maximum number of tweets to use", 1, 300, 100, 10)
95
+
96
+ col1, col2 = st.columns(2)
97
+
98
+ with col1:
99
+ expected_lang = st.radio(
100
+ "What language should be assumed to be found?",
101
+ ('English', 'Use all the ones you know (~15 lang)'),
102
+ 0
103
+ )
104
+ with col2:
105
+ go_btn = st.button('Visualize')
106
 
107
  with st.spinner(text="Loading model..."):
108
  model = load_model(model_to_use[expected_lang])
 
111
 
112
  # st.write(usr.data.id)
113
 
114
+ if go_btn:
115
  with st.spinner(f"Getting to know the '{tw_user}'..."):
116
  tweets_objs = []
117
  while tw_sample >= 100: