-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
50 lines (31 loc) · 1.23 KB
/
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
41
42
43
44
45
46
47
48
49
from flask import Flask, send_from_directory, render_template, request, abort
import time
from src.inference import *
from src.map_selector import *
app = Flask(__name__, static_url_path="/static")
app.config.from_object("default_settings")
@app.route("/")
def index():
"""Return the main page."""
return send_from_directory("static", "index_2.html")
@app.route("/get_results", methods=["POST"])
def get_results():
""" Mask the buildings on the input image """
img_path = request.form['img_path']
print(img_path)
predicted_mask = make_prediction(img_path)
return render_template("results_2.html", timestamp=str(time.time()))
@app.route("/get_map_results", methods=["POST"])
def get_map_results():
""" Mask the buildings from the folium live map """
lat = float(request.form["lat"])
lng = float(request.form["lng"])
location = [lat, lng]
print(location)
m = render_map(location= location, aerial = True)
capture_map()
img_path = "../seg_build_flask/static/images/screenshot.png"
predicted_mask = make_prediction(img_path)
return render_template("results_2.html", timestamp = str(time.time()))
if __name__ == "__main__":
serve(app, host='0.0.0.0', port=5000)