-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
40 lines (29 loc) · 958 Bytes
/
app.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
"""
Simple flask app.
"""
from flask import (Flask,
jsonify,
render_template,
request)
from eyebnb_ec2.web_query import *
app = Flask(__name__)
@app.route('/')
def single_page():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def prediction():
data = request.json#get input passed by json file
print(data)
url_input = data.get('single_id')
# highest_exp = data.get('highest_exp')
feature_path = 'features/Boston-Massachusetts-US/Boston_feature_new_all.pickle'
if url_input:
print('get an url:{}'.format(url_input))
# result_apt,result_img = web_query(url_input, feature_path)
result = web_query(url_input, feature_path)
print(result)
return render_template('pictureGrids.html',data=result)
def main():
app.run(host='0.0.0.0', port=5000, debug=True)
if __name__ == '__main__':
main()