ashishraics commited on
Commit
4f10488
1 Parent(s): 78e3bab

updated app

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import pandas as pd
2
  import streamlit as st
 
3
  from sentiment import classify_sentiment
4
 
5
  st.set_page_config( # Alternate names: setup_page, page, layout
@@ -7,15 +8,16 @@ st.set_page_config( # Alternate names: setup_page, page, layout
7
  initial_sidebar_state="auto", # Can be "auto", "expanded", "collapsed"
8
  page_title='None', # String or None. Strings get appended with "• Streamlit".
9
  )
10
- # padding_top = 0
11
- # st.markdown(f"""
12
- # <style>
13
- # .reportview-container .main .block-container{{
14
- # padding-top: {padding_top}rem;
15
- # }}
16
- # </style>""",
17
- # unsafe_allow_html=True,
18
- # )
 
19
 
20
  def set_page_title(title):
21
  st.sidebar.markdown(unsafe_allow_html=True, body=f"""
@@ -69,4 +71,9 @@ if select_task=='Detect Sentiment':
69
  if input_texts!='':
70
  sentiments = classify_sentiment(input_texts)
71
  for i,t in enumerate(input_texts.split(',')):
72
- st.write("** " + t + f"--> This statement is {sentiments[i]}")
 
 
 
 
 
 
1
  import pandas as pd
2
  import streamlit as st
3
+ from streamlit_text_rating.st_text_rater import st_text_rater
4
  from sentiment import classify_sentiment
5
 
6
  st.set_page_config( # Alternate names: setup_page, page, layout
 
8
  initial_sidebar_state="auto", # Can be "auto", "expanded", "collapsed"
9
  page_title='None', # String or None. Strings get appended with "• Streamlit".
10
  )
11
+
12
+ padding_top = 0
13
+ st.markdown(f"""
14
+ <style>
15
+ .reportview-container .main .block-container{{
16
+ padding-top: {padding_top}rem;
17
+ }}
18
+ </style>""",
19
+ unsafe_allow_html=True,
20
+ )
21
 
22
  def set_page_title(title):
23
  st.sidebar.markdown(unsafe_allow_html=True, body=f"""
 
71
  if input_texts!='':
72
  sentiments = classify_sentiment(input_texts)
73
  for i,t in enumerate(input_texts.split(',')):
74
+ if sentiments[i]=='Positive':
75
+ response=st_text_rater(t + f"--> This statement is {sentiments[i]}",
76
+ color_background='rgb(154,205,50)')
77
+ else:
78
+ response = st_text_rater(t + f"--> This statement is {sentiments[i]}",
79
+ color_background='rgb(233, 116, 81)')