Waraporn commited on
Commit
0103a37
1 Parent(s): 11fa468

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -37,16 +37,16 @@ def main():
37
  st.title("Adult Income")
38
 
39
  with st.form("questionaire"):
40
- age = # user's input
41
- workclass = # user's input
42
- education = # user's input
43
- Marital_Status = # user's input
44
- occupation = # user's input
45
- relationship = # user's input
46
- race = # user's input
47
- sex = # user's input
48
- hours_per_week = # user's input
49
- native_country = # user's input
50
 
51
  # clicked==True only when the button is clicked
52
  clicked = st.form_submit_button("Predict income")
@@ -62,5 +62,9 @@ def main():
62
  "hours.per.week": [hours_per_week],
63
  "native.country": [native_country]}))
64
  # Show prediction
 
 
65
 
66
  # Run main()
 
 
 
37
  st.title("Adult Income")
38
 
39
  with st.form("questionaire"):
40
+ age = st.slider("Age", min_value=10, max_value=100)
41
+ workclass = st.selectbox("Workclass", options=unique_class)
42
+ education = st.selectbox("education", options=unique_education)
43
+ Marital_Status = st.selectbox("Marital_Status", options=unique_Marital_Status)
44
+ occupation = st.selectbox("occupation", options=unique_occupation)
45
+ relationship = st.selectbox("relationship ", options=unique_relationship)
46
+ race = st.selectbox("race ", options=unique_race)
47
+ sex = st.selectbox("sex ", options=unique_sex)
48
+ hours_per_week = st.slider("hours_per_week ", min_value=1, max_value=100)
49
+ native_country = st.selectbox("native_country ", options=unique_country)
50
 
51
  # clicked==True only when the button is clicked
52
  clicked = st.form_submit_button("Predict income")
 
62
  "hours.per.week": [hours_per_week],
63
  "native.country": [native_country]}))
64
  # Show prediction
65
+ result = '>50K' if result[0] == 1 else '<50'
66
+ st.success("Your prediction income is ", result)
67
 
68
  # Run main()
69
+ if __name__ = "__main__":
70
+ main()