allenchienxxx commited on
Commit
b6b0d32
·
1 Parent(s): bc375ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -10
app.py CHANGED
@@ -1,13 +1,25 @@
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 +41,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 display_feature():
9
+ features = get_features(filepath)
10
+
11
+ def main():
12
+ st.title("Phishing Email Filtering Service")
13
+ uploaded_file = st.file_uploader("Upload a file", type=['eml', 'txt'])
14
+ if uploaded_file is not None:
15
+ if is_valid_filetype(uploaded_file):
16
+ st.success("File uploaded successfully!")
17
+ # Process the file here
18
+ save_file(uploaded_file)
19
+
20
+ else:
21
+ st.error("Invalid file type. Please upload an EML or TXT file.")
22
 
 
 
 
 
 
 
 
 
23
  def upload_file():
24
  if request.method == 'POST':
25
  # Check if a file was uploaded
 
41
  return render_template('home.html')
42
 
43
 
 
44
  if __name__ == '__main__':
45
+ main()
46
+