robertou2 commited on
Commit
9b86f4b
1 Parent(s): 40b93ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
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=’Enter name’):
19
- search_words = st.text_input(‘Enter the name for which you want to know the sentiment’)
20
- number_of_tweets = st.number_input(‘Enter the number of latest tweets for which you want to know the sentiment(Maximum 50 tweets)’, 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,lang=”en”).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()
 
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()