Joshua1808 commited on
Commit
b4a66f8
·
1 Parent(s): 0e521b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -125,7 +125,7 @@ def analizar_tweets(search_words, number_of_tweets ):
125
  logits1 = logits1.detach().cpu().numpy()
126
  # Store predictions and true labels
127
  predictions.append(logits1)
128
-
129
  #flat_predictions = [item for sublist in predictions for item in sublist]
130
  flat_predictions = [item for sublist in predictions for item in sublist]
131
 
@@ -139,7 +139,7 @@ def analizar_tweets(search_words, number_of_tweets ):
139
  df['Tweets'] = df['Tweets'].str.replace('RT|@', '')
140
  #df['Tweets'] = df['Tweets'].apply(lambda x: re.sub(r'[:;][-o^]?[)\]DpP3]|[(/\\]|[\U0001f600-\U0001f64f]|[\U0001f300-\U0001f5ff]|[\U0001f680-\U0001f6ff]|[\U0001f1e0-\U0001f1ff]','', x))
141
 
142
- st.table(df.reset_index(drop=True).head(20).style.applymap(color_survived, subset=['Sexista']))
143
 
144
  return df
145
 
@@ -194,7 +194,7 @@ def analizar_frase(frase):
194
  text= pd.DataFrame({'Frase': [frase], 'Prediccion':[flat_predictions], 'Probabilidad':[probabilidad_sexista]})
195
  text['prediccion'] = np.where(text['prediccion'] == 0 , 'No Sexista', 'Sexista')
196
 
197
- st.table(df.reset_index(drop=True).head(20).style.applymap(color_survived, subset=['Sexista']))
198
 
199
  return text
200
 
 
125
  logits1 = logits1.detach().cpu().numpy()
126
  # Store predictions and true labels
127
  predictions.append(logits1)
128
+
129
  #flat_predictions = [item for sublist in predictions for item in sublist]
130
  flat_predictions = [item for sublist in predictions for item in sublist]
131
 
 
139
  df['Tweets'] = df['Tweets'].str.replace('RT|@', '')
140
  #df['Tweets'] = df['Tweets'].apply(lambda x: re.sub(r'[:;][-o^]?[)\]DpP3]|[(/\\]|[\U0001f600-\U0001f64f]|[\U0001f300-\U0001f5ff]|[\U0001f680-\U0001f6ff]|[\U0001f1e0-\U0001f1ff]','', x))
141
 
142
+ st.table(df.reset_index(drop=True).head(20).style.applymap(color_survived, subset=['Sexista']))
143
 
144
  return df
145
 
 
194
  text= pd.DataFrame({'Frase': [frase], 'Prediccion':[flat_predictions], 'Probabilidad':[probabilidad_sexista]})
195
  text['prediccion'] = np.where(text['prediccion'] == 0 , 'No Sexista', 'Sexista')
196
 
197
+ st.table(df.reset_index(drop=True).head(20).style.applymap(color_survived, subset=['Sexista']))
198
 
199
  return text
200