Jessycao commited on
Commit
c2dcbdf
·
1 Parent(s): bfc0e39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,7 +12,7 @@ loaded_model = pickle.load(open("heart_xgb.pkl", 'rb'))
12
  # Setup SHAP
13
  explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
14
 
15
- sex = {"Female":1,"Male":0}
16
  cp = {"Typical angina":0,"Atypical angina":1,"Non-anginal pain":2,"Asymptomatic":3}
17
  bloodsuguar = {"True":1, "False":0}
18
  rest = {"Probable or Definite Left Ventricular Hypertrophy by Estes' Criteria":0, "Having ST - T Wave Abnormality":1,"Normal Value":2}
@@ -22,7 +22,7 @@ th = {"Reversible Defect":0, "Normal Blood Flow":1, "Fixed Defect":2}
22
 
23
  # Create the main function for server
24
  def main_func(age, sex, cp, trtbps, chol, fbs, restecg, thalachh,exng,oldpeak,slp,caa,thall):
25
- new_row = pd.DataFrame.from_dict({'age':age,'sex':[sex],
26
  'cp':cp[cp],'trtbps':trtbps,'chol':chol,
27
  'fbs':bloodsuguar[fbs], 'restecg':rest[restecg],'thalachh':thalachh,'exng':ex[exng],
28
  'oldpeak':oldpeak,'slp':sl[slp],'caa':caa,'thall':thl[thall]},
 
12
  # Setup SHAP
13
  explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
14
 
15
+ gender = {"Female":1,"Male":0}
16
  cp = {"Typical angina":0,"Atypical angina":1,"Non-anginal pain":2,"Asymptomatic":3}
17
  bloodsuguar = {"True":1, "False":0}
18
  rest = {"Probable or Definite Left Ventricular Hypertrophy by Estes' Criteria":0, "Having ST - T Wave Abnormality":1,"Normal Value":2}
 
22
 
23
  # Create the main function for server
24
  def main_func(age, sex, cp, trtbps, chol, fbs, restecg, thalachh,exng,oldpeak,slp,caa,thall):
25
+ new_row = pd.DataFrame.from_dict({'age':age,'sex':gender[sex],
26
  'cp':cp[cp],'trtbps':trtbps,'chol':chol,
27
  'fbs':bloodsuguar[fbs], 'restecg':rest[restecg],'thalachh':thalachh,'exng':ex[exng],
28
  'oldpeak':oldpeak,'slp':sl[slp],'caa':caa,'thall':thl[thall]},