-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.py
31 lines (24 loc) · 891 Bytes
/
main.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
from flask import Flask, render_template, request
app = Flask(__name__)
import pickle
file = open('model.pkl', 'rb')
clf = pickle.load(file)
file.close()
@app.route('/', methods=["GET", "POST"])
def hello_world():
if request.method == "POST":
myDict = request.form
fever = int(myDict['fever'])
age = int(myDict['age'])
pain = int(myDict['pain'])
runnyNose = int(myDict['runnyNose'])
diffBreath = int(myDict['diffBreath'])
# Code for Inference
inputFeatures = [fever, pain, age, runnyNose, diffBreath]
infProb =clf.predict_proba([inputFeatures])[0][1]
print(infProb)
return render_template('show.html', inf=round(infProb)*100)
return render_template('index.html')
# return 'Hello, World!' + str(infProb)
if __name__=="__main__":
app.run(debug=True)