Spaces:
Runtime error
Runtime error
Commit
·
4dcdda4
1
Parent(s):
73c054e
Update app.py
Browse files
app.py
CHANGED
@@ -97,23 +97,23 @@ with colT2:
|
|
97 |
|
98 |
|
99 |
def analizar_tweets(search_words, number_of_tweets ):
|
100 |
-
tweets = api.user_timeline(screen_name = search_words, count= number_of_tweets)
|
101 |
-
for
|
102 |
-
tweet_list = tweet.text
|
103 |
-
|
104 |
-
#tweet_list = [i.text for i in tweets]
|
105 |
text= pd.DataFrame(tweet_list)
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
112 |
df = pd.DataFrame(data)
|
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 |
|
119 |
def analizar_frase(frase):
|
|
|
97 |
|
98 |
|
99 |
def analizar_tweets(search_words, number_of_tweets ):
|
100 |
+
tweets = api.user_timeline(screen_name = search_words,tweet_mode="extended", count= number_of_tweets)
|
101 |
+
tweet_list = [i.full_text for i in tweets]
|
|
|
|
|
|
|
102 |
text= pd.DataFrame(tweet_list)
|
103 |
+
text[0] = text[0].apply(preprocess_tweet)
|
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 |
+
#df = pd.DataFrame(result)
|
112 |
df = pd.DataFrame(data)
|
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 |
|
119 |
def analizar_frase(frase):
|