Junr-syl commited on
Commit
bd26754
·
1 Parent(s): eee9e8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -20,7 +20,7 @@ st.set_page_config(page_title='Sentiments Analysis',page_icon='😎',layout='wid
20
 
21
  #welcome Animation
22
  com.iframe("https://embed.lottiefiles.com/animation/149093")
23
- st.markdown('<h1> Tweet Sentiments </h1>',unsafe_allow_html=True)
24
 
25
  #Create a form to take user inputs
26
  with st.form(key='tweet',clear_on_submit=True):
@@ -68,23 +68,23 @@ if submit:
68
  ranking = np.argsort(scores)
69
  ranking = ranking[::-1]
70
  l = config.id2label[ranking[0]]
71
- s = scores[ranking[0]]
72
 
73
  #output
74
  if l=='NEGATIVE':
75
  with col1:
76
  com.iframe("https://embed.lottiefiles.com/animation/125694")
77
- col2.write('Negative')
78
  col3.write(f'{s}%')
79
  elif l=='POSITIVE':
80
  with col1:
81
  com.iframe("https://embed.lottiefiles.com/animation/148485")
82
- col2.write('Positive')
83
  col3.write(f'{s}%')
84
  else:
85
  with col1:
86
  com.iframe("https://embed.lottiefiles.com/animation/136052")
87
- col2.write('Neutral')
88
  col3.write(f'{s}%')
89
 
90
 
 
20
 
21
  #welcome Animation
22
  com.iframe("https://embed.lottiefiles.com/animation/149093")
23
+ st.markdown("<h1 style='text-align: center'> Tweet Sentiments </h1>",unsafe_allow_html=True)
24
 
25
  #Create a form to take user inputs
26
  with st.form(key='tweet',clear_on_submit=True):
 
68
  ranking = np.argsort(scores)
69
  ranking = ranking[::-1]
70
  l = config.id2label[ranking[0]]
71
+ s = round(scores[ranking[0]],2)
72
 
73
  #output
74
  if l=='NEGATIVE':
75
  with col1:
76
  com.iframe("https://embed.lottiefiles.com/animation/125694")
77
+ col2.write('NEGATIVE')
78
  col3.write(f'{s}%')
79
  elif l=='POSITIVE':
80
  with col1:
81
  com.iframe("https://embed.lottiefiles.com/animation/148485")
82
+ col2.write('POSITIVE')
83
  col3.write(f'{s}%')
84
  else:
85
  with col1:
86
  com.iframe("https://embed.lottiefiles.com/animation/136052")
87
+ col2.write('NEUTRAL')
88
  col3.write(f'{s}%')
89
 
90