-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (20 loc) · 663 Bytes
/
app.py
File metadata and controls
27 lines (20 loc) · 663 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
from flask import Flask, request, jsonify, render_template
from backend import run_deforestation_pipeline
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/predict', methods=['POST'])
def predict():
data = request.get_json()
result = run_deforestation_pipeline(
lat_min=data['lat_min'],
lat_max=data['lat_max'],
lon_min=data['lon_min'],
lon_max=data['lon_max'],
start_year=data['start_year'],
end_year=data['end_year']
)
return jsonify(result)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)