-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
111 lines (77 loc) · 2.58 KB
/
app.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from flask import Flask, request, jsonify
from flask_cors import CORS, cross_origin
from flask.helpers import send_from_directory
import pickle
app = Flask(__name__, static_folder="frontend/build", static_url_path='')
CORS(app)
with open('diabetes', 'rb') as f:
diabetes_model = pickle.load(f)
@app.route("/api/diabetes", methods=['POST'])
def post__diabetes_data():
Pregnancies = int(request.json.get('preg'))
Glucose = int(request.json.get('glu'))
BloodPressure = int(request.json.get('bp'))
SkinThickness = int(request.json.get('st'))
Insulin = int(request.json.get('ins'))
BMI = float(request.json.get('bmi'))
DiabetesPedigreeFunction = float(request.json.get('dpf'))
Age = int(request.json.get('age'))
res = diabetes_model.predict(
[[Pregnancies, Glucose, BloodPressure, SkinThickness, Insulin, BMI, DiabetesPedigreeFunction, Age]])
if (res[0] == 0):
return jsonify({'result': 0})
else:
return jsonify({'result': 1})
@app.route("/api/heart", methods=['POST'])
def post_heart_data():
res = 0
if (res[0] == 0):
return jsonify({'result': 0})
else:
return jsonify({'result': 1})
@app.route("/api/kidney", methods=['POST'])
def post_kidney_data():
res = 0
if (res[0] == 0):
return jsonify({'result': 0})
else:
return jsonify({'result': 1})
@app.route("/api/kidney", methods=['POST'])
def post_liver_data():
res = 0
if (res[0] == 0):
return jsonify({'result': 0})
else:
return jsonify({'result': 1})
@app.route("/")
def hello_world():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/works")
def works():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/liver")
def liver():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/kidney")
def kidney():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/heart")
def heart():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/diabetes")
def diabetes():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/about")
def about():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/offer")
def offer():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/tech")
def tech():
return send_from_directory(app.static_folder, 'index.html')
@app.route("/tech")
def result():
return send_from_directory(app.static_folder, 'index.html')
if __name__ == "__main__":
app.run(debug=True, port=8000)