Spaces:
Runtime error
Runtime error
Commit
·
a0c7133
1
Parent(s):
bdb23ce
Update app.py
Browse files
app.py
CHANGED
@@ -156,23 +156,23 @@ def tweets_localidad(buscar_localidad):
|
|
156 |
#df.sort_values(by='Prediccion', ascending=False, inplace=True)
|
157 |
df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
158 |
df['Probabilidad'] = df['Probabilidad'].round(3)
|
159 |
-
|
160 |
-
tab1, tab2 = st.tabs(["🗃 Data","📈 Chart"])
|
161 |
-
tab1.st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
176 |
|
177 |
|
178 |
|
@@ -231,7 +231,6 @@ def run():
|
|
231 |
with col2:
|
232 |
tweets_usuario(search_words,number_of_tweets)
|
233 |
elif (localidad):
|
234 |
-
with col2:
|
235 |
tweets_localidad(search_words)
|
236 |
|
237 |
run()
|
|
|
156 |
#df.sort_values(by='Prediccion', ascending=False, inplace=True)
|
157 |
df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
158 |
df['Probabilidad'] = df['Probabilidad'].round(3)
|
|
|
|
|
|
|
159 |
|
160 |
+
col1, col2 = st.columns(2)
|
161 |
+
with col1:
|
162 |
+
muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
163 |
+
with col2:
|
164 |
+
resultado = df['Prediccion'].value_counts()
|
165 |
+
colores=["#EE3555","#aae977"]
|
166 |
+
fig, ax = plt.subplots()
|
167 |
+
fig.set_size_inches(2, 2)
|
168 |
+
plt.pie(resultado,labels=resultado.index,autopct='%1.1f%%',colors=colores, textprops={'fontsize': 4})
|
169 |
+
ax.set_title("Porcentajes por Categorias", fontsize=5, fontweight="bold")
|
170 |
+
plt.rcParams.update({'font.size':4, 'font.weight':'bold'})
|
171 |
+
ax.legend()
|
172 |
+
# Muestra el gráfico
|
173 |
+
plt.show()
|
174 |
+
st.set_option('deprecation.showPyplotGlobalUse', False)
|
175 |
+
#st.pyplot()
|
176 |
|
177 |
|
178 |
|
|
|
231 |
with col2:
|
232 |
tweets_usuario(search_words,number_of_tweets)
|
233 |
elif (localidad):
|
|
|
234 |
tweets_localidad(search_words)
|
235 |
|
236 |
run()
|