zonova commited on
Commit
377b230
1 Parent(s): d3983b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -16,14 +16,14 @@ def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
16
  early_stopping_rounds = 0,
17
  scale_pos_weight=1)
18
  '''
 
19
  with open('HH_ensemble_classifier_online.json', 'r') as file:
20
- model_data = json.load(file)
21
- for item in model_data:
22
- index = item['index']
23
- model = pickle.loads(item['model'].encode('latin1'))
24
- loaded_models.append(model)
25
-
26
- classifier_list = loaded_models
27
  '''
28
  xgb_reg.load_model('classifier_fewer_features_HH.json')
29
  '''
@@ -40,9 +40,9 @@ def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
40
  user_input[cat_features] = user_input[cat_features].copy().astype('category')
41
 
42
 
43
- predictions = np.zeros((len(classifier_list),2))
44
- for i in range(len(classifier_list)):
45
- predictions[i] = classifier_list[i].predict_proba(user_input[cont_features + cat_features])
46
  averaged_prediction = predictions.mean(axis=0)
47
  '''
48
  pred = xgb_reg.predict_proba(user_input)
 
16
  early_stopping_rounds = 0,
17
  scale_pos_weight=1)
18
  '''
19
+ loaded_models = []
20
  with open('HH_ensemble_classifier_online.json', 'r') as file:
21
+ model_data = json.load(file)
22
+ for item in model_data:
23
+ index = item['index']
24
+ model = pickle.loads(item['model'].encode('latin1'))
25
+ loaded_models.append(model)
26
+
 
27
  '''
28
  xgb_reg.load_model('classifier_fewer_features_HH.json')
29
  '''
 
40
  user_input[cat_features] = user_input[cat_features].copy().astype('category')
41
 
42
 
43
+ predictions = np.zeros((len(loaded_models),2))
44
+ for i in range(len(loaded_models)):
45
+ predictions[i] = loaded_models[i].predict_proba(user_input[cont_features + cat_features])
46
  averaged_prediction = predictions.mean(axis=0)
47
  '''
48
  pred = xgb_reg.predict_proba(user_input)