Pranjal-psytech commited on
Commit
cfb6de6
1 Parent(s): d03fc86
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,7 +15,7 @@ loaded_model = joblib.load('heart.pkl')
15
 
16
 
17
 
18
- def heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca,thal):
19
  #turning the arguments into a numpy array
20
 
21
  x = np.array([age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca,thal],dtype=float)
@@ -36,7 +36,7 @@ examples = [
36
  [72, 1, 3, 160, 114, 0, 0, 115, 0, 1.1, 2, 0, 7],
37
  ]
38
 
39
- app = gr.Interface(fn=heart_disease, inputs=[
40
  gr.inputs.Number(label="Age"),
41
  gr.inputs.Number(label="Sex (0 for Female, 1 for Male)"),
42
  gr.inputs.Number(label="Chest Pain Type (0 for Typical Angina, 1 for Atypical Angina, 2 for Non-Anginal Pain, 3 for Asymptomatic)"),
@@ -50,7 +50,7 @@ app = gr.Interface(fn=heart_disease, inputs=[
50
  gr.inputs.Number(label="Slope of the Peak Exercise ST Segment (0 for Upsloping, 1 for Flat, 2 for Downsloping)"),
51
  gr.inputs.Number(label="Number of Major Vessels (0-3) Colored by Fluoroscopy"),
52
  gr.inputs.Number(label="Thalassemia (3 for Normal, 6 for Fixed Defect, 7 for Reversible Defect)")
53
- ], outputs=outputs, examples=examples,title="Heart Disease Prediction",description='''
54
  This model predicts the presence of heart disease based on various input parameters. Please enter the values for the following inputs:
55
 
56
  Description about the inputs. age: The age of the patient in years.
 
15
 
16
 
17
 
18
+ def predict_heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca,thal):
19
  #turning the arguments into a numpy array
20
 
21
  x = np.array([age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca,thal],dtype=float)
 
36
  [72, 1, 3, 160, 114, 0, 0, 115, 0, 1.1, 2, 0, 7],
37
  ]
38
 
39
+ app = gr.Interface(fn=predict_heart_disease, inputs=[
40
  gr.inputs.Number(label="Age"),
41
  gr.inputs.Number(label="Sex (0 for Female, 1 for Male)"),
42
  gr.inputs.Number(label="Chest Pain Type (0 for Typical Angina, 1 for Atypical Angina, 2 for Non-Anginal Pain, 3 for Asymptomatic)"),
 
50
  gr.inputs.Number(label="Slope of the Peak Exercise ST Segment (0 for Upsloping, 1 for Flat, 2 for Downsloping)"),
51
  gr.inputs.Number(label="Number of Major Vessels (0-3) Colored by Fluoroscopy"),
52
  gr.inputs.Number(label="Thalassemia (3 for Normal, 6 for Fixed Defect, 7 for Reversible Defect)")
53
+ ], outputs=outputs, examples=examples,examples_output = [predict_heart_disease(*example) for example in examples],title="Heart Disease Prediction",description='''
54
  This model predicts the presence of heart disease based on various input parameters. Please enter the values for the following inputs:
55
 
56
  Description about the inputs. age: The age of the patient in years.