pachteera commited on
Commit
d93d2b0
1 Parent(s): 5c5fbb8

Upload 4 files

Browse files
Files changed (4) hide show
  1. app (1).py +86 -0
  2. model_n.joblib +3 -0
  3. requirements.txt +5 -0
  4. unique_values_n.joblib +3 -0
app (1).py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+ EDU_DICT = {'18-24': 1,
6
+ '25-29': 2,
7
+ '30-34': 3,
8
+ '35-39': 4,
9
+ '40-44': 5,
10
+ '45-49': 6,
11
+ '50-54': 7,
12
+ '55-59': 8,
13
+ '60-64': 9,
14
+ '65-69': 10,
15
+ '70-74': 11,
16
+ '75-79': 12,
17
+ '80+': 13
18
+ }
19
+
20
+
21
+ model = joblib.load('model_n.joblib')
22
+ unique_values = joblib.load('unique_values_n.joblib')
23
+
24
+ #unique_General_Health = unique_values["General_Health"]
25
+ unique_Checkup = unique_values["Checkup"]
26
+ unique_Exercise = unique_values["Exercise"]
27
+ unique_Heart_Disease = unique_values["Heart_Disease"]
28
+ unique_Skin_Cancer = unique_values["Skin_Cancer"]
29
+ unique_Other_Cancer = unique_values["Other_Cancer"]
30
+ unique_Depression = unique_values["Depression"]
31
+ unique_Diabetes = unique_values["Diabetes"]
32
+ unique_Arthritis = unique_values["Arthritis"]
33
+ unique_Sex = unique_values["Sex"]
34
+ unique_Age_Category = unique_values["Age_Category"]
35
+ unique_Smoking_History = unique_values["Smoking_History"]
36
+
37
+
38
+
39
+ def main():
40
+ st.title("General Health analysis")
41
+
42
+ with st.form("questionaire"):
43
+
44
+ Checkup = st.selectbox("Checkup", unique_Checkup)
45
+ Exercise = st.selectbox("Exercise", unique_Exercise)
46
+ Heart_Disease = st.selectbox("Heart Disease", unique_Heart_Disease)
47
+ Skin_Cancer = st.selectbox("Skin Cancer", unique_Skin_Cancer)
48
+ Other_Cancer = st.selectbox("Other Cancer", unique_Other_Cancer)
49
+ Depression = st.selectbox("Depression", unique_Depression)
50
+ Diabetes = st.selectbox("Diabetes", unique_Diabetes)
51
+ Arthritis = st.selectbox("Arthritis", unique_Arthritis)
52
+ Sex = st.selectbox("Sex", unique_Sex)
53
+ Age_Category = st.selectbox("Age Category", unique_Age_Category)
54
+ BMI = st.slider("BMI", min_value=1, max_value=50)
55
+ Smoking_History = st.selectbox("Smoking History", unique_Smoking_History)
56
+ Alcohol_Consumption = st.slider("Alcohol Consumption", min_value=0, max_value=100)
57
+ Fruit_Consumption = st.slider("Fruit Consumption", min_value=0, max_value=100)
58
+ Green_Vegetables_Consumption = st.slider("Green Vegetables Consumption", min_value=0, max_value=100)
59
+ FriedPotato_Consumption = st.slider("Fried Potato Consumption", min_value=0, max_value=100)
60
+
61
+
62
+
63
+
64
+ clicked = st.form_submit_button("Predict General Health")
65
+ if clicked:
66
+ result=model.predict(pd.DataFrame({"Checkup": [Checkup],
67
+ "Exercise": [workclass],
68
+ "Heart_Disease": [Heart_Disease],
69
+ "Skin_Cancer": [Skin_Cancer],
70
+ "Other_Cancer": [Other_Cancer],
71
+ "Depression": [Depression],
72
+ "Diabetes": [Diabetes],
73
+ "Arthritis": [Arthritis],
74
+ "Sex": [Sex],
75
+ "Age_Category": [EDU_DICT[Age_Category]],
76
+ "BMI": [BMI],
77
+ "Smoking_History": [Smoking_History],
78
+ "Alcohol_Consumption": [Alcohol_Consumption],
79
+ "Fruit_Consumption": [Fruit_Consumption],
80
+ "Green_Vegetables_Consumption": [Green_Vegetables_Consumption],
81
+ "FriedPotato_Consumption": [FriedPotato_Consumption]}))
82
+ result = 'Very Good' if result[0] == 1 else 'Poor'
83
+ st.success('The predicted General Health is {}'.format(result))
84
+
85
+ if __name__=='__main__':
86
+ main()
model_n.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9828fcd1b2a260dc306f18f8a62b95fbf0399c31acd41442ed0a088f8cd3b561
3
+ size 406684
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ joblib
2
+ pandas
3
+ scikit-learn==1.2.2
4
+ xgboost==1.7.6
5
+ altair<5
unique_values_n.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e1fbc2c2741192f750d364c6e3e9e0a11e3f6ab6df24a9c923be6f17f30e64d
3
+ size 3308