allenchienxxx commited on
Commit
4a604a4
1 Parent(s): bc375ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -1,13 +1,20 @@
1
  from analze import *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- app = Flask(__name__)
4
-
5
- @app.route('/')
6
- def home():
7
- return render_template('home.html')
8
-
9
-
10
- @app.route('/upload', methods=['GET', 'POST'])
11
  def upload_file():
12
  if request.method == 'POST':
13
  # Check if a file was uploaded
@@ -29,6 +36,6 @@ def upload_file():
29
  return render_template('home.html')
30
 
31
 
32
-
33
  if __name__ == '__main__':
34
- app.run(host='0.0.0.0', port=8000)
 
 
1
  from analze import *
2
+ import streamlit as st
3
+
4
+ def is_valid_filetype(file):
5
+ valid_extensions = ['.eml', '.txt']
6
+ return any(file.name.endswith(ext) for ext in valid_extensions)
7
+
8
+ def main():
9
+ st.title("Phishing Email Filtering Service")
10
+ uploaded_file = st.file_uploader("Upload a file", type=['eml', 'txt'])
11
+ if uploaded_file is not None:
12
+ if is_valid_filetype(uploaded_file):
13
+ st.success("File uploaded successfully!")
14
+ # Process the file here
15
+ else:
16
+ st.error("Invalid file type. Please upload an EML or TXT file.")
17
 
 
 
 
 
 
 
 
 
18
  def upload_file():
19
  if request.method == 'POST':
20
  # Check if a file was uploaded
 
36
  return render_template('home.html')
37
 
38
 
 
39
  if __name__ == '__main__':
40
+ main()
41
+