Spaces:
Runtime error
Runtime error
Commit
·
645e710
1
Parent(s):
9e0c8f4
Update app.py
Browse files
app.py
CHANGED
@@ -143,23 +143,19 @@ def tweets_localidad(buscar_localidad):
|
|
143 |
etiqueta = {'Tweets': datos,'Prediccion': predic['label'], 'Probabilidad': predic['score']}
|
144 |
result.append(etiqueta)
|
145 |
df = pd.DataFrame(result)
|
146 |
-
|
147 |
-
#muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
148 |
-
|
149 |
if df.empty:
|
150 |
muestra=st.text("No se encontraron tweets sexistas dentro de la localidad")
|
151 |
tabla.append(muestra)
|
152 |
else:
|
153 |
#tabla.append(muestra)
|
154 |
-
df.sort_values(by=['Prediccion', 'Probabilidad'], ascending=[False, False], inplace=True)
|
|
|
155 |
df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
156 |
-
|
157 |
-
#df = df[df["Probabilidad"] > 0.5]
|
158 |
-
#df = df.sort_values(by='Probabilidad', ascending=False)
|
159 |
-
df['Probabilidad'] = df['Probabilidad'].apply(lambda x: round(x, 3))
|
160 |
muestra = st.table(df.reset_index(drop=True).head(10).style.applymap(color_survived, subset=['Prediccion']))
|
161 |
tabla.append(muestra)
|
162 |
-
resultado=df.groupby('Prediccion')['Probabilidad'].sum()
|
|
|
163 |
colores=["#EE3555","#aae977"]
|
164 |
fig, ax = plt.subplots()
|
165 |
fig.set_size_inches(2, 2)
|
|
|
143 |
etiqueta = {'Tweets': datos,'Prediccion': predic['label'], 'Probabilidad': predic['score']}
|
144 |
result.append(etiqueta)
|
145 |
df = pd.DataFrame(result)
|
|
|
|
|
|
|
146 |
if df.empty:
|
147 |
muestra=st.text("No se encontraron tweets sexistas dentro de la localidad")
|
148 |
tabla.append(muestra)
|
149 |
else:
|
150 |
#tabla.append(muestra)
|
151 |
+
#df.sort_values(by=['Prediccion', 'Probabilidad'], ascending=[False, False], inplace=True)
|
152 |
+
df.sort_values(by='Prediccion', ascending=False, inplace=True)
|
153 |
df['Prediccion'] = np.where(df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
154 |
+
df['Probabilidad'] = df['Probabilidad'].round(3)
|
|
|
|
|
|
|
155 |
muestra = st.table(df.reset_index(drop=True).head(10).style.applymap(color_survived, subset=['Prediccion']))
|
156 |
tabla.append(muestra)
|
157 |
+
#resultado=df.groupby('Prediccion')['Probabilidad'].sum()
|
158 |
+
resultado = df['Prediccion'].value_counts()
|
159 |
colores=["#EE3555","#aae977"]
|
160 |
fig, ax = plt.subplots()
|
161 |
fig.set_size_inches(2, 2)
|