ShadowTEM commited on
Commit
0720d77
·
verified ·
1 Parent(s): 0d2270c

Upload app.py

Browse files
Files changed (1) hide show
  1. deployment/app.py +22 -0
deployment/app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ from controller.GetPredictions import GetPredictions
3
+ from controller.LoadModel import LoadModel
4
+
5
+ app = Flask(__name__)
6
+
7
+ model = LoadModel('deployment/models/heart_attack_detection_model_99.3%.pkl')
8
+
9
+ @app.route('/')
10
+ def home():
11
+ return render_template('home.html')
12
+
13
+ @app.route('/predict', methods=['POST'])
14
+ def predict():
15
+ if request.method == 'POST':
16
+ inputs = request.form.to_dict()
17
+ prediction = GetPredictions(model, inputs)
18
+
19
+ return render_template('result.html', prediction=prediction)
20
+
21
+ if __name__ == '__main__':
22
+ app.run(debug=True, host="0.0.0.0", port=8000)