forked from Xtremilicious/COVID-19-Probability-Detection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (23 loc) · 827 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
import pickle
from flask import Flask, render_template, request
app = Flask(__name__)
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'])
breathingDiff = int(myDict['breathingDiff'])
# Code for inference
inputFeatures = [fever, age, pain, runnyNose, breathingDiff]
infProb = clf.predict_proba([inputFeatures])[0][1]
print(infProb)
return render_template('show.html', inf=round(infProb*100))
return render_template('index.html')
if __name__ == "__main__":
app.run(debug=True)