Uvini commited on
Commit
c6c162c
1 Parent(s): ffc2dd7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -66,22 +66,23 @@ if file is not None:
66
  unsafe_allow_html=True
67
  )
68
 
 
 
 
 
 
 
 
69
  # Create HTML table with no border and centered text
70
  table_html = (df.style
71
  .set_properties(**{'text-align': 'left','font-size': '14px'})
72
  .set_table_styles([{'selector': 'th', 'props': [('border', '0px')]},
73
  {'selector': 'td', 'props': [('border', '0px')]}])
74
- .to_html(escape=False))
75
-
76
- # Add the selectbox to filter sentiments
77
- filter_sentiment = st.selectbox("Filter Sentiments", ["All"] + list(Sentiment.keys()))
78
-
79
- # Filter the dataframe based on the selected sentiment
80
- if filter_sentiment != "All":
81
- df = df[df['Sentiment'].str.contains(filter_sentiment)]
82
 
83
  # Display the table and the selectbox widget beside the title
84
  st.write(table_html, unsafe_allow_html=True)
85
 
 
86
  else:
87
  st.write("Please upload a CSV file.")
 
66
  unsafe_allow_html=True
67
  )
68
 
69
+ # Add the selectbox to filter sentiments
70
+ filter_sentiment = st.selectbox("Filter Sentiments", ["All", "POSITIVE", "NEGATIVE"])
71
+
72
+ # Filter the dataframe based on the selected sentiment
73
+ if filter_sentiment != "All":
74
+ df = df[df['sentiment'] == filter_sentiment]
75
+
76
  # Create HTML table with no border and centered text
77
  table_html = (df.style
78
  .set_properties(**{'text-align': 'left','font-size': '14px'})
79
  .set_table_styles([{'selector': 'th', 'props': [('border', '0px')]},
80
  {'selector': 'td', 'props': [('border', '0px')]}])
81
+ .to_html(index=False, escape=False))
 
 
 
 
 
 
 
82
 
83
  # Display the table and the selectbox widget beside the title
84
  st.write(table_html, unsafe_allow_html=True)
85
 
86
+
87
  else:
88
  st.write("Please upload a CSV file.")