Pranjal-psytech commited on
Commit
df591a9
1 Parent(s): 4a45805

Add application Better Interface

Browse files
Files changed (1) hide show
  1. app.py +47 -2
app.py CHANGED
@@ -28,12 +28,57 @@ def heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, ol
28
  return('The person has a heart disease')
29
 
30
  outputs = gr.outputs.Textbox()
 
 
31
  examples = [
32
  [59, 1, 1, 140, 221, 0, 1, 164, 1, 0.0, 2, 0, 2],
33
- # Add more examples here if you want
 
34
  ]
35
 
36
- app = gr.Interface(fn=heart_disease, inputs=['number','number','number','number','number','number','number','number','number','number','number','number','number'], outputs=outputs, examples=examples,description="This is a heart_disease model")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
 
39
  app.launch()
 
28
  return('The person has a heart disease')
29
 
30
  outputs = gr.outputs.Textbox()
31
+
32
+ # Define some example inputs for the interface
33
  examples = [
34
  [59, 1, 1, 140, 221, 0, 1, 164, 1, 0.0, 2, 0, 2],
35
+ [45, 0, 2, 125, 212, 1, 0, 168, 0, 1.6, 1, 0, 3],
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.Radio(choices=[("Male", 1), ("Female", 0)], label="Sex"),
42
+ gr.inputs.Radio(choices=[
43
+ ("Typical Angina", 0),
44
+ ("Atypical Angina", 1),
45
+ ("Non-Anginal Pain", 2),
46
+ ("Asymptomatic", 3)
47
+ ], label="Chest Pain Type"),
48
+ gr.inputs.Number(label="Resting Blood Pressure (mm Hg)"),
49
+ gr.inputs.Number(label="Serum Cholesterol Level (mg/dL)"),
50
+ gr.inputs.Radio(choices=[("Fasting Blood Sugar > 120 mg/dL", 1), ("Fasting Blood Sugar <= 120 mg/dL", 0)], label="Fasting Blood Sugar Level"),
51
+ gr.inputs.Radio(choices=[
52
+ ("Normal", 0),
53
+ ("ST-T Wave Abnormality", 1),
54
+ ("Probable or Definite Left Ventricular Hypertrophy", 2)
55
+ ], label="Resting Electrocardiographic Results"),
56
+ gr.inputs.Number(label="Maximum Heart Rate Achieved"),
57
+ gr.inputs.Radio(choices=[("Exercise-Induced Angina", 1), ("No Exercise-Induced Angina", 0)], label="Exercise-Induced Angina"),
58
+ gr.inputs.Number(label="ST Depression Induced by Exercise Relative to Rest"),
59
+ gr.inputs.Radio(choices=[("Upsloping", 0), ("Flat", 1), ("Downsloping", 2)], label="Slope of the Peak Exercise ST Segment"),
60
+ gr.inputs.Number(label="Number of Major Vessels (0-3) Colored by Fluoroscopy"),
61
+ gr.inputs.Radio(choices=[
62
+ ("Normal", 3),
63
+ ("Fixed Defect", 6),
64
+ ("Reversible Defect", 7)
65
+ ], label="Thalassemia")
66
+ ], outputs=outputs, examples=examples,title="Heart Disease Prediction",description='''
67
+ #This model predicts the presence of heart disease based on various input parameters. Please enter the values for the following inputs:
68
+
69
+ ##Description about the inputs. age: The age of the patient in years.
70
+ sex: The patient's gender (1 = male, 0 = female).
71
+ cp: Chest pain type (0 = typical angina, 1 = atypical angina, 2 = non-anginal pain, 3 = asymptomatic).
72
+ trestbps: Resting blood pressure (in mm Hg) on admission to the hospital.
73
+ chol: Serum cholesterol level (in mg/dL).
74
+ fbs: Fasting blood sugar level (> 120 mg/dL = 1, <= 120 mg/dL = 0).
75
+ restecg: Resting electrocardiographic results (0 = normal, 1 = having ST-T wave abnormality, 2 = showing probable or definite left ventricular hypertrophy).
76
+ thalach: Maximum heart rate achieved.
77
+ exang: Exercise-induced angina (1 = yes, 0 = no).
78
+ oldpeak: ST depression induced by exercise relative to rest.
79
+ slope: The slope of the peak exercise ST segment (0 = upsloping, 1 = flat, 2 = downsloping).
80
+ ca: Number of major vessels (0-3) colored by fluoroscopy.
81
+ thal: A blood disorder called thalassemia (3 = normal, 6 = fixed defect, 7 = reversible defect). ''')
82
 
83
 
84
  app.launch()