-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (23 loc) · 832 Bytes
/
app.py
File metadata and controls
33 lines (23 loc) · 832 Bytes
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
from flask import Flask
import threading
import uvicorn
import time
from client.imap_worker import *
from routes.inbox import inbox_bp
from routes.actions import actions_bp
from core.sse import stream
from api.predictor import app as fastapi_app
app = Flask(__name__, template_folder='templates', static_folder='static')
app.register_blueprint(inbox_bp)
app.register_blueprint(actions_bp)
def run_fastapi():
print("Starting FastAPI predictor API on http://0.0.0.0:8000 ...")
uvicorn.run(fastapi_app, host="0.0.0.0", port=8000, log_level="error")
@app.route("/stream")
def sse_stream():
return stream()
if __name__ == "__main__":
threading.Thread(target=run_fastapi, daemon=True).start()
time.sleep(2)
print("PhishAI Webmail")
app.run(host='0.0.0.0', port=1337, debug=False, use_reloader=False)