Joshua1808 commited on
Commit
c7136e6
·
1 Parent(s): 5137030

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -140,7 +140,7 @@ def tweets_localidad(buscar_localidad):
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)
@@ -158,8 +158,9 @@ def tweets_localidad(buscar_localidad):
158
  df = pd.DataFrame(result)
159
  df['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
160
  df['Probabilidad'] = df['Probabilidad'].apply(lambda x: '{:.2f}%'.format(x))
161
- df=df[df["Prediccion"] == 'Sexista']
162
- tabla = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
 
163
 
164
  df_sexista = df[df['Prediccion']=="Sexista"]
165
  df_no_sexista = df[df['Prediccion']=="No Sexista"]
@@ -177,6 +178,8 @@ def tweets_localidad(buscar_localidad):
177
  centre_circle = plt.Circle((0,0),0.70,fc='white')
178
  fig = plt.gcf()
179
  fig.gca().add_artist(centre_circle)
 
 
180
 
181
  # Equal aspect ratio ensures that pie is drawn as a circle
182
  ax1.axis('equal')
 
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)
 
158
  df = pd.DataFrame(result)
159
  df['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
160
  df['Probabilidad'] = df['Probabilidad'].apply(lambda x: '{:.2f}%'.format(x))
161
+ df.sort_values(by='Probabilidad', ascending=False, inplace=True)
162
+ #df=df[df["Prediccion"] == 'Sexista']
163
+ tabla = st.table(df.reset_index(drop=True).head(30).style.applymap(color_survived, subset=['Prediccion']))
164
 
165
  df_sexista = df[df['Prediccion']=="Sexista"]
166
  df_no_sexista = df[df['Prediccion']=="No Sexista"]
 
178
  centre_circle = plt.Circle((0,0),0.70,fc='white')
179
  fig = plt.gcf()
180
  fig.gca().add_artist(centre_circle)
181
+ fig1.set_size_inches(6, 6)
182
+
183
 
184
  # Equal aspect ratio ensures that pie is drawn as a circle
185
  ax1.axis('equal')