-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
35 lines (27 loc) · 1.01 KB
/
utils.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
import numpy as np
import pickle
import config
class DiabeticInfo():
def __init__(self,Glucose,BloodPressure,SkinThickness,Insulin,BMI,DiabetesPedigreeFunction,Age):
self.Glucose = Glucose
self.BloodPressure = BloodPressure
self.SkinThickness = SkinThickness
self.Insulin = Insulin
self.BMI = BMI
self.DiabetesPedigreeFunction = DiabetesPedigreeFunction
self.Age = Age
def load_data(self):
with open(config.MODEL_FILE_PATH,'rb') as f:
self.model = pickle.load(f)
def diabetic_pred(self):
self.load_data()
test_array = np.zeros([1,self.model.n_features_in_])
test_array[0,0]=self.Glucose
test_array[0,1]=self.BloodPressure
test_array[0,2]=self.SkinThickness
test_array[0,3]=self.Insulin
test_array[0,4]=self.BMI
test_array[0,5]=self.DiabetesPedigreeFunction
test_array[0,6]=self.Age
prediction = self.model.predict(test_array)[0]
return prediction