wszhang1021 commited on
Commit
f1b2e44
·
1 Parent(s): 1fa22f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -35
app.py CHANGED
@@ -40,41 +40,28 @@ def main_func(age, sex, cp, trtbps, chol, fbs, restecg, thalachh, exng, oldpeak,
40
  return {"Low Heart Attack Chance": float(prob[0][0]), "High Heart Attack Chance": 1-float(prob[0][0])}, local_plot
41
 
42
  # Create the UI
43
- title = "**Heart Attack Prediction Tool** 🏥🩺💊🩻"
44
  description1 = """
45
  This software retrieves data from individuals and anticipates their probability of experiencing a heart attack. However, it should not be utilized for medical diagnosis purposes.
46
  """
47
 
48
  description2 = """
49
- To use the app, click on one of the examples, or adjust the values of the factors, and click on Analyze.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
- Data Dictionary:
52
-
53
- Age : Age of the patient
54
-
55
- Sex : Sex of the patient
56
-
57
- cp : Chest Pain type
58
-
59
- trtbps: Resting Blood Pressure (in mm Hg)
60
-
61
- chol : Cholestoral in mg/dl Fetched via BMI Sensor
62
-
63
- fbs : (fasting blood sugar > 120 mg/dl)
64
-
65
- rest_ecg : Resting Electrocardiographic Results
66
-
67
- thalachh : Maximum Heart Rate Achieved
68
-
69
- exng: Exercise Induced Angina
70
-
71
- oldpeak : Short-Term Depression Induced by Exercise Relative to Rest
72
-
73
- slp : Slope of the Peak Exercise Short-Term Segment
74
-
75
- caa : Number of Major Vessels (0-3)
76
-
77
- thall : Thalassemia
78
  """
79
 
80
  with gr.Blocks(title=title) as demo:
@@ -87,12 +74,12 @@ with gr.Blocks(title=title) as demo:
87
 
88
  with gr.Row():
89
  with gr.Column():
90
- age = gr.Slider(label="age score", minimum=0, maximum=90, value=40, step=1)
91
- sex = gr.Dropdown(label="sex score", choices =["Female","Male"])
92
- cp = gr.Radio(label="cp score", choices = ["typical angina", "atypical angina", "non-anginal pain", "asymptomatic"])
93
- trtbps = gr.Slider(label="trtbps Score", minimum=90, maximum=200, value=90, step=1)
94
- chol = gr.Slider(label="chol Score", minimum=120, maximum=570, value=120, step=1)
95
- fbs = gr.Radio(label="fbs Score", choices = ["True", "False"])
96
  restecg = gr.Dropdown(label="restecg Score", choices = ["Probable or Definite Left Ventricular Hypertrophy by Estes' Criteria", "Having ST - T Wave Abnormality","Normal Value"])
97
  with gr.Column():
98
  thalachh = gr.Slider(label="thalachh Score", minimum=70, maximum=210, value=70, step=1)
 
40
  return {"Low Heart Attack Chance": float(prob[0][0]), "High Heart Attack Chance": 1-float(prob[0][0])}, local_plot
41
 
42
  # Create the UI
43
+ title = "🩺**Heart Attack Prediction Tool** 🏥"
44
  description1 = """
45
  This software retrieves data from individuals and anticipates their probability of experiencing a heart attack. However, it should not be utilized for medical diagnosis purposes.
46
  """
47
 
48
  description2 = """
49
+ Please adjust the values of the factors, then it will analyze your probability of getting heart attack.
50
+
51
+ Age: Age of the patient
52
+ Sex: Sex of the patient
53
+ Chest Pain Type (cp): Type of chest pain experienced by the patient
54
+ Resting Blood Pressure (trtbps): Blood pressure of the patient at rest, measured in millimeters of mercury (mm Hg)
55
+ Cholesterol (chol): Cholesterol level of the patient, measured in milligrams per deciliter (mg/dl) and fetched via BMI sensor
56
+ Fasting Blood Sugar (fbs): Fasting blood sugar level of the patient, measured in milligrams per deciliter (mg/dl) and indicating whether it is greater than 120 mg/dl
57
+ Resting Electrocardiographic Results (rest_ecg): Results of the resting electrocardiogram test
58
+ Maximum Heart Rate Achieved (thalachh): Maximum heart rate achieved by the patient
59
+ Exercise Induced Angina (exng): Whether the patient experienced exercise-induced angina or not
60
+ Short-Term Depression Induced by Exercise Relative to Rest (oldpeak): Amount of short-term depression in the ST segment induced by exercise relative to rest
61
+ Slope of the Peak Exercise Short-Term Segment (slp): Slope of the peak exercise ST segment
62
+ Number of Major Vessels (caa): Number of major vessels colored by fluoroscopy (0-3)
63
+ Thalassemia (thall): Type of thalassemia the patient has, if any.
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  """
66
 
67
  with gr.Blocks(title=title) as demo:
 
74
 
75
  with gr.Row():
76
  with gr.Column():
77
+ age = gr.Slider(label="Age", minimum=0, maximum=90, value=40, step=1)
78
+ sex = gr.Dropdown(label="Sex", choices =["Female","Male"])
79
+ cp = gr.Radio(label="Chest Pain Type", choices = ["typical angina", "atypical angina", "non-anginal pain", "asymptomatic"])
80
+ trtbps = gr.Slider(label="Resting Blood Pressure (in mm Hg)", minimum=90, maximum=200, value=90, step=1)
81
+ chol = gr.Slider(label="Cholestoral in mg/dl", minimum=120, maximum=570, value=120, step=1)
82
+ fbs = gr.Radio(label="Fasting Blood Sugar", choices = ["True", "False"])
83
  restecg = gr.Dropdown(label="restecg Score", choices = ["Probable or Definite Left Ventricular Hypertrophy by Estes' Criteria", "Having ST - T Wave Abnormality","Normal Value"])
84
  with gr.Column():
85
  thalachh = gr.Slider(label="thalachh Score", minimum=70, maximum=210, value=70, step=1)