-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (24 loc) · 722 Bytes
/
app.py
File metadata and controls
32 lines (24 loc) · 722 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
from flask import Flask, jsonify, request, render_template
from flask_cors import CORS
from PhishyClf.PhishyClf import *
app = Flask(__name__)
CORS(app)
@app.route('/hello', methods=['GET', 'POST'])
def hello():
# POST request
if request.method == 'POST':
return make_pred(), 200
# GET request
else:
message = {'greeting':'Hello from Flask!'}
return jsonify(message) # serialize and use JSON headers
@app.route('/test')
def test_page():
# look inside `templates` and serve `index.html`
return render_template('index.html')
@app.route('/', methods=['GET', 'POST'])
def homepage():
message = 'it works'
return message
if __name__ == "__main__":
app.run()