Spaces:
Runtime error
Runtime error
Commit
·
30abc5f
1
Parent(s):
f99d3df
Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ font-size:40px ; font-family: 'Cooper Black'; color: #301E67;}
|
|
68 |
</style> """, unsafe_allow_html=True)
|
69 |
|
70 |
#st.markdown('<p class="font"; style="text-align: center;>Análisis de comentarios sexistas en linea</p>', unsafe_allow_html=True)
|
71 |
-
st.markdown('<p class="font" style="text-align: center;">
|
72 |
|
73 |
|
74 |
st.markdown(""" <style> .font1 {
|
@@ -117,6 +117,9 @@ def tweets_usuario(usuario, cant_de_tweets):
|
|
117 |
df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
118 |
df['Probabilidad'] = df['Probabilidad'].apply(lambda x: round(x, 3))
|
119 |
muestra = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
|
|
|
|
|
|
|
120 |
tabla.append(muestra)
|
121 |
except Exception as e:
|
122 |
muestra = st.text(f"La cuenta {usuario} no existe.")
|
@@ -169,7 +172,7 @@ def tweets_localidad(buscar_localidad):
|
|
169 |
muestra_df = pd.concat([sexista_df, no_sexista_df], axis=0)
|
170 |
col1, col2 = st.columns(2)
|
171 |
with col1:
|
172 |
-
muestra = st.table(muestra_df.reset_index(drop=True).head(
|
173 |
with col2:
|
174 |
resultado = df['Prediccion'].value_counts()
|
175 |
def autopct_fun(abs_values):
|
@@ -178,10 +181,10 @@ def tweets_localidad(buscar_localidad):
|
|
178 |
|
179 |
colores=["#EE3555","#aae977"]
|
180 |
fig, ax = plt.subplots()
|
181 |
-
fig.set_size_inches(
|
182 |
-
plt.pie(resultado,labels=resultado.index,autopct=autopct_fun(resultado),colors=colores, textprops={'fontsize':
|
183 |
-
ax.set_title("Porcentajes por Categorias", fontsize=
|
184 |
-
plt.rcParams.update({'font.size':
|
185 |
ax.legend()
|
186 |
# Muestra el gráfico
|
187 |
plt.show()
|
|
|
68 |
</style> """, unsafe_allow_html=True)
|
69 |
|
70 |
#st.markdown('<p class="font"; style="text-align: center;>Análisis de comentarios sexistas en linea</p>', unsafe_allow_html=True)
|
71 |
+
st.markdown('<p class="font" style="text-align: center;">Detectanco el Sexismo en Linea: Un proyecto de Investigación</p>', unsafe_allow_html=True)
|
72 |
|
73 |
|
74 |
st.markdown(""" <style> .font1 {
|
|
|
117 |
df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
118 |
df['Probabilidad'] = df['Probabilidad'].apply(lambda x: round(x, 3))
|
119 |
muestra = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
|
120 |
+
if len(df) > 10:
|
121 |
+
# Agregar una barra de desplazamiento vertical a la tabla
|
122 |
+
muestra._parent.markdown(f'<style>.dataframe .data {{height: 300px; overflow: scroll}}</style>', unsafe_allow_html=True)
|
123 |
tabla.append(muestra)
|
124 |
except Exception as e:
|
125 |
muestra = st.text(f"La cuenta {usuario} no existe.")
|
|
|
172 |
muestra_df = pd.concat([sexista_df, no_sexista_df], axis=0)
|
173 |
col1, col2 = st.columns(2)
|
174 |
with col1:
|
175 |
+
muestra = st.table(muestra_df.reset_index(drop=True).head(6).style.applymap(color_survived, subset=['Prediccion']))
|
176 |
with col2:
|
177 |
resultado = df['Prediccion'].value_counts()
|
178 |
def autopct_fun(abs_values):
|
|
|
181 |
|
182 |
colores=["#EE3555","#aae977"]
|
183 |
fig, ax = plt.subplots()
|
184 |
+
fig.set_size_inches(4,4)
|
185 |
+
plt.pie(resultado,labels=resultado.index,autopct=autopct_fun(resultado),colors=colores, textprops={'fontsize': 5})
|
186 |
+
ax.set_title("Porcentajes por Categorias", fontsize=5, fontweight="bold")
|
187 |
+
plt.rcParams.update({'font.size':4, 'font.weight':'bold'})
|
188 |
ax.legend()
|
189 |
# Muestra el gráfico
|
190 |
plt.show()
|