Spaces:
Runtime error
Runtime error
Commit
·
fa5254c
1
Parent(s):
8f8b900
Update app.py
Browse files
app.py
CHANGED
@@ -126,7 +126,7 @@ def tweets_localidad(buscar_localidad):
|
|
126 |
geolocator = Nominatim(user_agent="nombre_del_usuario")
|
127 |
location = geolocator.geocode(buscar_localidad)
|
128 |
radius = "10km"
|
129 |
-
tweets = api.search_tweets(q="",lang="es",geocode=f"{location.latitude},{location.longitude},{radius}", count =
|
130 |
tweet_list = [i.full_text for i in tweets]
|
131 |
text= pd.DataFrame(tweet_list)
|
132 |
text[0] = text[0].apply(preprocess_tweet)
|
@@ -147,17 +147,15 @@ def tweets_localidad(buscar_localidad):
|
|
147 |
#df.sort_values(by='Probabilidad', ascending=False, inplace=True)
|
148 |
#df = df.sort_values(by=['Probabilidad', 'Prediccion'], ascending=[False, False])
|
149 |
#df=df[df["Prediccion"] == 'Sexista']
|
150 |
-
muestra = st.table(df.reset_index(drop=True).head(
|
151 |
tabla.append(muestra)
|
152 |
|
153 |
resultado=df.groupby('Prediccion')['Probabilidad'].sum()
|
154 |
colores=["#aae977","#EE3555"]
|
155 |
fig, ax = plt.subplots()
|
156 |
plt.pie(resultado,labels=resultado.index,autopct='%1.1f%%',colors=colores)
|
157 |
-
|
158 |
-
|
159 |
-
ax.set_title("Porcentajes por Categorias", fontsize=12, fontweight="bold")
|
160 |
-
plt.rcParams.update({'font.size':10, 'font.weight':'bold'})
|
161 |
ax.legend()
|
162 |
# Muestra el gráfico
|
163 |
plt.show()
|
|
|
126 |
geolocator = Nominatim(user_agent="nombre_del_usuario")
|
127 |
location = geolocator.geocode(buscar_localidad)
|
128 |
radius = "10km"
|
129 |
+
tweets = api.search_tweets(q="",lang="es",geocode=f"{location.latitude},{location.longitude},{radius}", count = 30, tweet_mode="extended")
|
130 |
tweet_list = [i.full_text for i in tweets]
|
131 |
text= pd.DataFrame(tweet_list)
|
132 |
text[0] = text[0].apply(preprocess_tweet)
|
|
|
147 |
#df.sort_values(by='Probabilidad', ascending=False, inplace=True)
|
148 |
#df = df.sort_values(by=['Probabilidad', 'Prediccion'], ascending=[False, False])
|
149 |
#df=df[df["Prediccion"] == 'Sexista']
|
150 |
+
muestra = st.table(df.reset_index(drop=True).head(30).style.applymap(color_survived, subset=['Prediccion']))
|
151 |
tabla.append(muestra)
|
152 |
|
153 |
resultado=df.groupby('Prediccion')['Probabilidad'].sum()
|
154 |
colores=["#aae977","#EE3555"]
|
155 |
fig, ax = plt.subplots()
|
156 |
plt.pie(resultado,labels=resultado.index,autopct='%1.1f%%',colors=colores)
|
157 |
+
ax.set_title("Porcentajes por Categorias", fontsize=8, fontweight="bold")
|
158 |
+
plt.rcParams.update({'font.size':8, 'font.weight':'bold'})
|
|
|
|
|
159 |
ax.legend()
|
160 |
# Muestra el gráfico
|
161 |
plt.show()
|