Joshua1808 commited on
Commit
ae4c78e
·
1 Parent(s): ec5e9ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -134,9 +134,9 @@ def tweets_localidad(buscar_localidad):
134
  etiqueta = {'Tweets': datos,'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.5]
140
  df = df.sort_values(by='Probabilidad', ascending=False)
141
  muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
142
  if df.empty:
@@ -145,7 +145,8 @@ def tweets_localidad(buscar_localidad):
145
  tabla.append(muestra)
146
  resultado=df.groupby('Prediccion')['Probabilidad'].sum()
147
  colores=["#aae977","#EE3555"]
148
- fig, ax = plt.subplots(figsize=(1, 1), subplotpars=None)
 
149
  plt.pie(resultado,labels=resultado.index,autopct='%1.1f%%',colors=colores)
150
  ax.set_title("Porcentajes por Categorias", fontsize=8, fontweight="bold")
151
  plt.rcParams.update({'font.size':8, 'font.weight':'bold'})
 
134
  etiqueta = {'Tweets': datos,'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.5]
140
  df = df.sort_values(by='Probabilidad', ascending=False)
141
  muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
142
  if df.empty:
 
145
  tabla.append(muestra)
146
  resultado=df.groupby('Prediccion')['Probabilidad'].sum()
147
  colores=["#aae977","#EE3555"]
148
+ fig, ax = plt.subplots()
149
+ fig.set_size_inches(1, 1)
150
  plt.pie(resultado,labels=resultado.index,autopct='%1.1f%%',colors=colores)
151
  ax.set_title("Porcentajes por Categorias", fontsize=8, fontweight="bold")
152
  plt.rcParams.update({'font.size':8, 'font.weight':'bold'})