ISOM5240GP4 commited on
Commit
fbd79d5
·
verified ·
1 Parent(s): 7d63c56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -176,4 +176,24 @@ Sarah
176
  st.session_state.result_type = result_type
177
  else:
178
  st.session_state.result = "Please enter an email body or select a sample to analyze."
179
- st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  st.session_state.result_type = result_type
177
  else:
178
  st.session_state.result = "Please enter an email body or select a sample to analyze."
179
+ st.session_state.result_type = ""
180
+ with col_clear:
181
+ if st.button("Clear", key="clear"):
182
+ st.session_state.email_body = ""
183
+ st.session_state.result = ""
184
+ st.session_state.result_type = ""
185
+ st.rerun()
186
+
187
+ # Display result with styled box
188
+ if st.session_state.result:
189
+ if st.session_state.result_type == "spam":
190
+ st.markdown(f'<div class="spam-result">{st.session_state.result}</div>', unsafe_allow_html=True)
191
+ elif st.session_state.result_type == "positive":
192
+ st.markdown(f'<div class="positive-result">{st.session_state.result}</div>', unsafe_allow_html=True)
193
+ elif st.session_state.result_type == "negative":
194
+ st.markdown(f'<div class="negative-result">{st.session_state.result}</div>', unsafe_allow_html=True)
195
+ else:
196
+ st.write(st.session_state.result) # For error messages
197
+
198
+ if __name__ == "__main__":
199
+ main()