Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,17 +15,17 @@ st.title('Analisis de comentarios sexistas en Twitter con Tweepy and HuggingFace
|
|
| 15 |
st.markdown('Esta app utiliza tweepy para descargar get tweets de twitter en base a la información de de entrada y procesa los tweets usando transformers de HuggingFace para detectar comentarios sexsitas. El resultado y los tweets correspondientes se almacenan en un dataframe para mostrarlo que es lo que se ve como resultado')
|
| 16 |
|
| 17 |
def run():
|
| 18 |
-
with st.form(key
|
| 19 |
-
search_words = st.text_input(
|
| 20 |
-
number_of_tweets = st.number_input(
|
| 21 |
-
submit_button = st.form_submit_button(label
|
| 22 |
if submit_button:
|
| 23 |
-
tweets =tw.Cursor(api.search_tweets,q=search_words
|
| 24 |
tweet_list = [i.text for i in tweets]
|
| 25 |
p = [i for i in classifier(tweet_list)]
|
| 26 |
q=[p[i][‘label’] for i in range(len(p))]
|
| 27 |
-
df = pd.DataFrame(list(zip(tweet_list, q)),columns =[
|
| 28 |
st.write(df)
|
| 29 |
|
| 30 |
-
if __name__
|
| 31 |
run()
|
|
|
|
| 15 |
st.markdown('Esta app utiliza tweepy para descargar get tweets de twitter en base a la información de de entrada y procesa los tweets usando transformers de HuggingFace para detectar comentarios sexsitas. El resultado y los tweets correspondientes se almacenan en un dataframe para mostrarlo que es lo que se ve como resultado')
|
| 16 |
|
| 17 |
def run():
|
| 18 |
+
with st.form(key='Introduzca nombre'):
|
| 19 |
+
search_words = st.text_input('Introduzca el termino para analizar')
|
| 20 |
+
number_of_tweets = st.number_input('Introduzca número de twweets a analizar. Máximo 50', 0,50,10)
|
| 21 |
+
submit_button = st.form_submit_button(label='Submit')
|
| 22 |
if submit_button:
|
| 23 |
+
tweets =tw.Cursor(api.search_tweets,q=search_words).items(number_of_tweets)
|
| 24 |
tweet_list = [i.text for i in tweets]
|
| 25 |
p = [i for i in classifier(tweet_list)]
|
| 26 |
q=[p[i][‘label’] for i in range(len(p))]
|
| 27 |
+
df = pd.DataFrame(list(zip(tweet_list, q)),columns =['Latest'+str(number_of_tweets)+'Tweets'+'on'+search_words, 'sentiment'])
|
| 28 |
st.write(df)
|
| 29 |
|
| 30 |
+
if __name__=='__main__':
|
| 31 |
run()
|