Upload 4 files
Browse files- app (2).py +90 -0
- model_n.joblib +3 -0
- requirements.txt +5 -0
- unique_values_n.joblib +3 -0
app (2).py
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
Weight_ == st.slider("Weight_(kg)", min_value=100, max_value=200)
|
61 |
+
Height_ == st.slider("Height_(cm)", min_value=100, max_value=200)
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
clicked = st.form_submit_button("Predict General Health")
|
67 |
+
if clicked:
|
68 |
+
result=model.predict(pd.DataFrame({"Checkup": [Checkup],
|
69 |
+
"Exercise": [Exercise],
|
70 |
+
"Heart_Disease": [Heart_Disease],
|
71 |
+
"Skin_Cancer": [Skin_Cancer],
|
72 |
+
"Other_Cancer": [Other_Cancer],
|
73 |
+
"Depression": [Depression],
|
74 |
+
"Diabetes": [Diabetes],
|
75 |
+
"Arthritis": [Arthritis],
|
76 |
+
"Sex": [Sex],
|
77 |
+
"Age_Category": [EDU_DICT[Age_Category]],
|
78 |
+
"BMI": [BMI],
|
79 |
+
"Smoking_History": [Smoking_History],
|
80 |
+
"Alcohol_Consumption": [Alcohol_Consumption],
|
81 |
+
"Fruit_Consumption": [Fruit_Consumption],
|
82 |
+
"Green_Vegetables_Consumption": [Green_Vegetables_Consumption],
|
83 |
+
"FriedPotato_Consumption": [FriedPotato_Consumption],
|
84 |
+
"Weight_(kg)": [Weight_],
|
85 |
+
"Height_(cm)": [Height_]}))
|
86 |
+
result = 'Very Good' if result[0] == 1 else 'Poor'
|
87 |
+
st.success('The predicted General Health is {}'.format(result))
|
88 |
+
|
89 |
+
if __name__=='__main__':
|
90 |
+
main()
|
model_n.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:768211c97b9fb1cdadf6ddc106dc17099267d7c46f91239b9c7566853add2d87
|
3 |
+
size 376097
|
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:905cd1a1edec7e903345f03557f7b8eab46362f62190f9a314de42c6af9ba2d0
|
3 |
+
size 3216
|