Spaces:
Runtime error
Runtime error
Commit
·
8603ae2
1
Parent(s):
cf37902
Update app.py
Browse files
app.py
CHANGED
@@ -134,25 +134,22 @@ def tweets_localidad(buscar_localidad):
|
|
134 |
etiqueta = {'Tweets': text,'Prediccion': predic['label'], 'Probabilidad': predic['score']}
|
135 |
result.append(etiqueta)
|
136 |
df = pd.DataFrame(result)
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
plt.show()
|
154 |
-
st.set_option('deprecation.showPyplotGlobalUse', False)
|
155 |
-
st.pyplot()
|
156 |
|
157 |
except AttributeError:
|
158 |
st.text("No existe ninguna localidad con ese nombre")
|
|
|
134 |
etiqueta = {'Tweets': text,'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.80]
|
140 |
+
muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
141 |
+
tabla.append(muestra)
|
142 |
+
resultado=df.groupby('Prediccion')['Probabilidad'].sum()
|
143 |
+
colores=["#aae977","#EE3555"]
|
144 |
+
fig, ax = plt.subplots(figsize=(4, 4), subplotpars=None)
|
145 |
+
plt.pie(resultado,labels=resultado.index,autopct='%1.1f%%',colors=colores)
|
146 |
+
ax.set_title("Porcentajes por Categorias", fontsize=8, fontweight="bold")
|
147 |
+
plt.rcParams.update({'font.size':8, 'font.weight':'bold'})
|
148 |
+
ax.legend()
|
149 |
+
# Muestra el gráfico
|
150 |
+
plt.show()
|
151 |
+
st.set_option('deprecation.showPyplotGlobalUse', False)
|
152 |
+
st.pyplot()
|
|
|
|
|
|
|
153 |
|
154 |
except AttributeError:
|
155 |
st.text("No existe ninguna localidad con ese nombre")
|