criticalDanger commited on
Commit
2cd231c
1 Parent(s): 1753d99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -8,13 +8,21 @@ with open('asthma_disease_model.pkl', 'rb') as file:
8
 
9
  # Define the prediction function
10
  def predict_heart_disease(Age, Gender, BMI, Smoking, PhysicalActivity, DietQuality, SleepQuality, PollutionExposure, PollenExposure, DustExposure, PetAllergy, FamilyHistoryAsthma, HistoryOfAllergies, Eczema, HayFever, GastroesophagealReflux, Wheezing, ShortnessOfBreath, ChestTightness, Coughing, NighttimeSymptoms, ExerciseInduced):
11
- male = 1 if male == "Male" else 0
12
- currentSmoker = 1 if currentSmoker == "Yes" else 0
13
- BPMeds = 1 if BPMeds == "Yes" else 0
14
- prevalentStroke = 1 if prevalentStroke == "Yes" else 0
15
- prevalentHyp = 1 if prevalentHyp == "Yes" else 0
16
- diabetes = 1 if diabetes == "Yes" else 0
17
- input_data = np.array([[male, age, currentSmoker, cigsPerDay, BPMeds, prevalentStroke, prevalentHyp, diabetes, BMI]])
 
 
 
 
 
 
 
 
18
  prediction = model.predict(input_data)
19
  return 'Heart Disease' if prediction[0] == 1 else 'No Heart Disease'
20
 
@@ -23,18 +31,18 @@ inputs = [
23
  gr.Number(label="Age"),
24
  gr.Radio(choices=["Male","Female"], label="Sex")
25
  gr.Number(value=float, label="What is your BMI?"),
26
- gr.Radio(chpices=["Yes","No"], label="Do you smoke?"),
27
- gr.Slider(label="Rate your physical activeness", minimum=0, maximum=10, step=0.1),
28
  gr.Slider(label="Rate your diet quality", minimum=0, maximum=10, step=1),
29
  gr.Slider(label="Rate your sleep quality", minimum=4, maximum=10, step=1),
30
  gr.Slider(label="Rate your pollution exposure", minimum=0, maximum=10, step=1),
31
  gr.Slider(label="Rate your pollen exposure", minimum=0, maximum=10, step=1),
32
  gr.Slider(label="Rate your dust exposure", minimum=0, maximum=10, step=1),
33
- gr.Checkbox(label="Pet Allergy"),
34
- gr.Checkbox(label="Family History of Asthma"),
35
  gr.Checkbox(label="Do you have history of allergies?"),
36
- gr.Checkbox(label="Eczema"),
37
- gr.Checkbox(label="Hay fever"),
38
  gr.Checkbox(label="Do you have Gastroesophageal Reflux?"),
39
  gr.Checkbox(label="Do you wheeze?"),
40
  gr.Checkbox(label="Do you feel shortness of breath?"),
 
8
 
9
  # Define the prediction function
10
  def predict_heart_disease(Age, Gender, BMI, Smoking, PhysicalActivity, DietQuality, SleepQuality, PollutionExposure, PollenExposure, DustExposure, PetAllergy, FamilyHistoryAsthma, HistoryOfAllergies, Eczema, HayFever, GastroesophagealReflux, Wheezing, ShortnessOfBreath, ChestTightness, Coughing, NighttimeSymptoms, ExerciseInduced):
11
+ Gender = 0 if Gender == "Male" else 1
12
+ Smoking = 1 if Smoking else 0
13
+ PetAllergy = 1 if PetAllergy else 0
14
+ FamilyHistoryAsthma = 1 if FamilyHistoryAsthma else 0
15
+ HistoryOfAllergies = 1 if HistoryOfAllergies else 0
16
+ Eczema = 1 if Eczema else 0
17
+ HayFever = 1 if HayFever else 0
18
+ GastroesophagealReflux = 1 if GastroesophagealReflux else 0
19
+ Wheezing = 1 if Wheezing else 0
20
+ ShortnessOfBreath = 1 if ShortnessOfBreath else 0
21
+ ChestTightness = 1 if ChestTightness else 0
22
+ Coughing = 1 if Coughing else 0
23
+ NighttimeSymptoms = 1 if NighttimeSymptoms else 0
24
+ ExerciseInduced = 1 if ExerciseInduced else 0
25
+ input_data = np.array([[Age, Gender, BMI, Smoking, PhysicalActivity, DietQuality, SleepQuality, PollutionExposure, PollenExposure, DustExposure, PetAllergy, FamilyHistoryAsthma, HistoryOfAllergies, Eczema, HayFever, GastroesophagealReflux, Wheezing, ShortnessOfBreath, ChestTightness, Coughing, NighttimeSymptoms, ExerciseInduced]])
26
  prediction = model.predict(input_data)
27
  return 'Heart Disease' if prediction[0] == 1 else 'No Heart Disease'
28
 
 
31
  gr.Number(label="Age"),
32
  gr.Radio(choices=["Male","Female"], label="Sex")
33
  gr.Number(value=float, label="What is your BMI?"),
34
+ gr.Checkbox(label="Do you smoke?"),
35
+ gr.Slider(label="Rate your physical activeness", minimum=0, maximum=10, step=1),
36
  gr.Slider(label="Rate your diet quality", minimum=0, maximum=10, step=1),
37
  gr.Slider(label="Rate your sleep quality", minimum=4, maximum=10, step=1),
38
  gr.Slider(label="Rate your pollution exposure", minimum=0, maximum=10, step=1),
39
  gr.Slider(label="Rate your pollen exposure", minimum=0, maximum=10, step=1),
40
  gr.Slider(label="Rate your dust exposure", minimum=0, maximum=10, step=1),
41
+ gr.Checkbox(label="Do you have Pet Allergy?"),
42
+ gr.Checkbox(label="Does your family have a history of Asthma"),
43
  gr.Checkbox(label="Do you have history of allergies?"),
44
+ gr.Checkbox(label="Do you have Eczema"),
45
+ gr.Checkbox(label="Do you have Hay fever"),
46
  gr.Checkbox(label="Do you have Gastroesophageal Reflux?"),
47
  gr.Checkbox(label="Do you wheeze?"),
48
  gr.Checkbox(label="Do you feel shortness of breath?"),