-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
40 lines (29 loc) · 1.08 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from mails.detect import detect_spam_emails
import streamlit as st
def main():
""" This is a function used to design the default webpage. """
st.set_page_config(
page_title='SpamSlayer',
page_icon=':envelope:',
layout='centered'
)
# loading custom css file
with open('static/css/styles.css') as stylesheet:
st.markdown(f'<style>{stylesheet.read()}</style>', unsafe_allow_html=True)
st.title(':envelope: :blue[Spam]Slayer')
st.subheader('This is a web-based spam mail detector')
st.divider()
with st.form('emails_forms'):
email_msg = st.text_area(
label='Email',
placeholder='Type an email text here ...'
)
submitted = st.form_submit_button('Submit')
if submitted: # if button is clicked
if email_msg: # if text area is not blank
message = detect_spam_emails(email_msg)
return message
else:
st.warning('Please enter an email', icon='⚠️')
if __name__ == '__main__':
main()