Joshua1808 commited on
Commit
2ba6811
1 Parent(s): 2e8cc31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -106,6 +106,8 @@ def analizar_tweets(search_words, number_of_tweets):
106
  df = df[df["Probabilidad"] > 0.5]
107
  muestra = st.table(df.reset_index(drop=True).head(30).style.applymap(color_survived, subset=['Prediccion']))
108
  if df.empty:
 
 
109
  tabla.append(muestra)
110
  #resultado=df.groupby('Prediccion')['Probabilidad'].sum()
111
  #colores=["#aae977","#EE3555"]
@@ -118,8 +120,6 @@ def analizar_tweets(search_words, number_of_tweets):
118
  #plt.show()
119
  #st.set_option('deprecation.showPyplotGlobalUse', False)
120
  #st.pyplot()
121
- else:
122
- st.text("No hay tweets a analizar")
123
  except Exception as e:
124
  st.text(f"La cuenta {search_words} no existe.")
125
 
@@ -203,8 +203,24 @@ def run():
203
  localidad=st.checkbox('Localidad')
204
  submit_button = col.form_submit_button(label='Analizar')
205
  error =False
206
-
207
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  if submit_button:
209
  # Condici贸n para el caso de que esten dos check seleccionados
210
  if ( termino == False and usuario == False and localidad == False):
 
106
  df = df[df["Probabilidad"] > 0.5]
107
  muestra = st.table(df.reset_index(drop=True).head(30).style.applymap(color_survived, subset=['Prediccion']))
108
  if df.empty:
109
+ st.text("No hay tweets a analizar")
110
+ else:
111
  tabla.append(muestra)
112
  #resultado=df.groupby('Prediccion')['Probabilidad'].sum()
113
  #colores=["#aae977","#EE3555"]
 
120
  #plt.show()
121
  #st.set_option('deprecation.showPyplotGlobalUse', False)
122
  #st.pyplot()
 
 
123
  except Exception as e:
124
  st.text(f"La cuenta {search_words} no existe.")
125
 
 
203
  localidad=st.checkbox('Localidad')
204
  submit_button = col.form_submit_button(label='Analizar')
205
  error =False
206
+ clear_button = col.clear_button(label='Limpiar')
207
+ err = False
208
+
209
+ if clear_button:
210
+ if(search_words == ""):
211
+ err=True
212
+ elif(number_of_tweets == 0):
213
+ err=True
214
+
215
+ if(err == False):
216
+ if(search_words != ""):
217
+ search_words.clear()
218
+ err=True
219
+ elif(number_of_tweets >0):
220
+ number_of_tweets.clear()
221
+ err=true
222
+
223
+
224
  if submit_button:
225
  # Condici贸n para el caso de que esten dos check seleccionados
226
  if ( termino == False and usuario == False and localidad == False):