-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (22 loc) · 801 Bytes
/
app.py
File metadata and controls
27 lines (22 loc) · 801 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, render_template
import backend.backend as backend
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
state = None
if request.method == 'POST':
state = request.form.get('state')
return render_template('index.html', state=state)
@app.route('/send-data', methods=['POST'])
def receive_data():
data = request.json
state_name = data.get('state')
# Process the state name as needed
# For example, you can pass it to your model function
# and return the result
# result = {'message': f'Received state: {state_name}'}
result = backend.pred_disaster(state_name)
return result
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True) #WARNING OPEN TO ALL IPs
# app.run()