Joshua1808 commited on
Commit
1bf00e3
·
1 Parent(s): e7f1e6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -135,16 +135,16 @@ def analizar_frase(frase):
135
  return tabla
136
 
137
  def tweets_localidad(buscar_localidad):
138
- tabla = pd.DataFrame()
139
  try:
140
  geolocator = Nominatim(user_agent="nombre_del_usuario")
141
  location = geolocator.geocode(buscar_localidad)
142
  radius = "10km"
143
- tweets = api.search_tweets(q="",lang="es",geocode=f"{location.latitude},{location.longitude},{radius}", count = 30, tweet_mode="extended")
144
 
145
  tweet_list = [i.full_text for i in tweets]
146
  text= pd.DataFrame(tweet_list)
147
- text[0] = text[0].apply(preprocess)
148
  text_list = text[0].tolist()
149
  result = []
150
  for text in text_list:
@@ -161,8 +161,8 @@ def tweets_localidad(buscar_localidad):
161
  #df.sort_values(by='Probabilidad', ascending=False, inplace=True)
162
  #df = df.sort_values(by=['Probabilidad', 'Prediccion'], ascending=[False, False])
163
  #df=df[df["Prediccion"] == 'Sexista']
164
- tabla = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
165
-
166
  df_sexista = df[df['Prediccion']=="Sexista"]
167
  df_no_sexista = df[df['Prediccion']=="No Sexista"]
168
  sexista = len(df_sexista)
@@ -191,8 +191,6 @@ def tweets_localidad(buscar_localidad):
191
  except AttributeError:
192
  st.text("No existe ninguna localidad con ese nombre")
193
 
194
-
195
-
196
  return tabla
197
 
198
  def run():
 
135
  return tabla
136
 
137
  def tweets_localidad(buscar_localidad):
138
+ tabla = []
139
  try:
140
  geolocator = Nominatim(user_agent="nombre_del_usuario")
141
  location = geolocator.geocode(buscar_localidad)
142
  radius = "10km"
143
+ tweets = api.search_tweets(q="",lang="es",geocode=f"{location.latitude},{location.longitude},{radius}", count = 50, tweet_mode="extended")
144
 
145
  tweet_list = [i.full_text for i in tweets]
146
  text= pd.DataFrame(tweet_list)
147
+ text[0] = text[0].apply(preprocess_tweet)
148
  text_list = text[0].tolist()
149
  result = []
150
  for text in text_list:
 
161
  #df.sort_values(by='Probabilidad', ascending=False, inplace=True)
162
  #df = df.sort_values(by=['Probabilidad', 'Prediccion'], ascending=[False, False])
163
  #df=df[df["Prediccion"] == 'Sexista']
164
+ muestra = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
165
+ tabla.append(muestra)
166
  df_sexista = df[df['Prediccion']=="Sexista"]
167
  df_no_sexista = df[df['Prediccion']=="No Sexista"]
168
  sexista = len(df_sexista)
 
191
  except AttributeError:
192
  st.text("No existe ninguna localidad con ese nombre")
193
 
 
 
194
  return tabla
195
 
196
  def run():