Joshua1808 commited on
Commit
485e4eb
·
1 Parent(s): ae4c78e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -86,7 +86,7 @@ def analizar_tweets(search_words, number_of_tweets ):
86
  for tweet in tweets:
87
  if (tweet.full_text.startswith('RT')):
88
  continue
89
- elif not tweet.full_text.strip():
90
  continue
91
  else:
92
  datos = preprocess(tweet.full_text)
@@ -123,9 +123,9 @@ def tweets_localidad(buscar_localidad):
123
  tweets = api.search_tweets(q="",lang="es",geocode=f"{location.latitude},{location.longitude},{radius}", count = 500, tweet_mode="extended")
124
  result = []
125
  for tweet in tweets:
126
- if (tweet.full_text.startswith):
127
  continue
128
- elif not tweet.full_text.strip():
129
  continue
130
  else:
131
  datos = preprocess(tweet.full_text)
@@ -134,11 +134,12 @@ def tweets_localidad(buscar_localidad):
134
  etiqueta = {'Tweets': datos,'Prediccion': predic['label'], 'Probabilidad': predic['score']}
135
  result.append(etiqueta)
136
  df = pd.DataFrame(result)
137
- #df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
138
- #df = df[df["Prediccion"] == 'Sexista']
139
- #df = df[df["Probabilidad"] > 0.5]
140
  df = df.sort_values(by='Probabilidad', ascending=False)
141
  muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
 
142
  if df.empty:
143
  st.text("No se encontraron tweets sexistas dentro de la localidad")
144
  else:
 
86
  for tweet in tweets:
87
  if (tweet.full_text.startswith('RT')):
88
  continue
89
+ elif not tweet.full_text.strip():
90
  continue
91
  else:
92
  datos = preprocess(tweet.full_text)
 
123
  tweets = api.search_tweets(q="",lang="es",geocode=f"{location.latitude},{location.longitude},{radius}", count = 500, tweet_mode="extended")
124
  result = []
125
  for tweet in tweets:
126
+ if (tweet.full_text.startswith('RT')):
127
  continue
128
+ elif not tweet.full_text.strip:
129
  continue
130
  else:
131
  datos = preprocess(tweet.full_text)
 
134
  etiqueta = {'Tweets': datos,'Prediccion': predic['label'], 'Probabilidad': predic['score']}
135
  result.append(etiqueta)
136
  df = pd.DataFrame(result)
137
+ df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
138
+ df = df[df["Prediccion"] == 'Sexista']
139
+ df = df[df["Probabilidad"] > 0.5]
140
  df = df.sort_values(by='Probabilidad', ascending=False)
141
  muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
142
+
143
  if df.empty:
144
  st.text("No se encontraron tweets sexistas dentro de la localidad")
145
  else: