Joshua1808 commited on
Commit
ea0ca81
·
1 Parent(s): 28a1750

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -104,14 +104,15 @@ def analizar_tweets(search_words, number_of_tweets ):
104
  text_list = text[0].tolist()
105
  result = []
106
  for text in text_list:
107
- prediction = pipeline_nlp(text)
108
- etiqueta= [{'Tweets': text,'Prediccion': predic['label'], 'Probabilidad': predic['score']} for predic in prediction]
109
- result.append(etiqueta)
110
-
111
- data = pd.DataFrame(result)
112
- #data['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
 
113
 
114
- tabla = st.table(data)
115
 
116
  return tabla
117
 
 
104
  text_list = text[0].tolist()
105
  result = []
106
  for text in text_list:
107
+ prediction = pipeline_nlp(text)
108
+ for predic in prediction:
109
+ etiqueta = {'Tweets': text,'Prediccion': predic['label'], 'Probabilidad': predic['score']}
110
+ result.append(etiqueta)
111
+
112
+ df = pd.DataFrame(result)
113
+ df['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
114
 
115
+ tabla = st.table(df.reset_index(drop=True).head(30).style.applymap(color_survived, subset=['Prediccion']))
116
 
117
  return tabla
118