-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.py
More file actions
46 lines (32 loc) · 996 Bytes
/
deploy.py
File metadata and controls
46 lines (32 loc) · 996 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from flask import Flask,render_template,request
import numpy as np
import pickle
model=pickle.load(open('model_final.pkl','rb'))
app=Flask(__name__)
@app.route('/predict' , methods=["POST","GET"])
def predict():
a=request.form.get('usmr')
b=request.form.get('patient_type')
c=request.form.get('pneumonia')
d=request.form['age']
e=request.form.get('diabetes')
f=request.form.get('hypertension')
g=request.form.get('renal_chronic')
input=[a,b,c,d,e,f,g,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
h=request.form['medical_unit']
input[5+int(h)]=1
i=request.form['classification']
input[17+ int(i)]=1
input=np.array(input,dtype=int)
print(input)
input=input.reshape(1,25)
prediction=model.predict(input)
if(prediction[0]==2):
ans="survive"
else:
ans=None
return render_template('result1.html',answer=ans)
@app.route('/')
def main():
return render_template('index.html')
app.run(debug=True)