Spaces:
Runtime error
Runtime error
Commit
·
73c054e
1
Parent(s):
cadaacb
Update app.py
Browse files
app.py
CHANGED
@@ -98,21 +98,18 @@ with colT2:
|
|
98 |
|
99 |
def analizar_tweets(search_words, number_of_tweets ):
|
100 |
tweets = api.user_timeline(screen_name = search_words, count= number_of_tweets)
|
101 |
-
|
102 |
-
|
103 |
|
104 |
-
tweet_list = [i.text for i in tweets]
|
105 |
text= pd.DataFrame(tweet_list)
|
106 |
-
text[0] = text[0].apply(preprocess_tweet)
|
107 |
-
|
|
|
108 |
predictions = pipeline_nlp(text1)
|
109 |
-
data = [{'Texto':
|
110 |
# crea un DataFrame a partir de la lista de diccionarios
|
111 |
df = pd.DataFrame(data)
|
112 |
-
|
113 |
-
Tweets =['Últimos '+ str(number_of_tweets)+' Tweets'+' de '+search_words]
|
114 |
-
df = pd.DataFrame(list(zip(text1, flat_predictions,probability)), columns = ['Tweets' , 'Prediccion','Probabilidad'])
|
115 |
-
|
116 |
df['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
117 |
|
118 |
tabla = st.table(df.reset_index(drop=True).head(30).style.applymap(color_survived, subset=['Prediccion']))
|
|
|
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 tweet in tweets:
|
102 |
+
tweet_list = tweet.text
|
103 |
|
104 |
+
#tweet_list = [i.text for i in tweets]
|
105 |
text= pd.DataFrame(tweet_list)
|
106 |
+
#text[0] = text[0].apply(preprocess_tweet)
|
107 |
+
text= text.apply(preprocess_tweet)
|
108 |
+
#text1=text[0].values
|
109 |
predictions = pipeline_nlp(text1)
|
110 |
+
data = [{'Texto': text, 'Prediccion': prediction['label'], 'Probabilidad': prediction['score']} for prediction in predictions]
|
111 |
# crea un DataFrame a partir de la lista de diccionarios
|
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']))
|