Spaces:
Runtime error
Runtime error
PongsakornSET
commited on
Commit
•
990349c
1
Parent(s):
49286c2
Update app.py
Browse files
app.py
CHANGED
@@ -36,16 +36,16 @@ def main():
|
|
36 |
st.title("Adult Income")
|
37 |
|
38 |
with st.form("questionaire"):
|
39 |
-
age = # user's input
|
40 |
-
workclass = # user's input
|
41 |
-
education = # user's input
|
42 |
-
Marital_Status = # user's input
|
43 |
-
occupation = # user's input
|
44 |
-
relationship = # user's input
|
45 |
-
race = # user's input
|
46 |
-
sex = # user's input
|
47 |
-
hours_per_week = # user's input
|
48 |
-
native_country = # user's input
|
49 |
|
50 |
# clicked==True only when the button is clicked
|
51 |
clicked = st.form_submit_button("Predict income")
|
@@ -60,6 +60,10 @@ def main():
|
|
60 |
"sex": [sex],
|
61 |
"hours.per.week": [hours_per_week],
|
62 |
"native.country": [native_country]}))
|
63 |
-
# Show prediction
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
# Run main()
|
|
|
36 |
st.title("Adult Income")
|
37 |
|
38 |
with st.form("questionaire"):
|
39 |
+
age = st.slider("Age",min_value=10,max_value=100)# user's input
|
40 |
+
workclass = st.selectbox("Workcalss",option=unique_class)# user's input
|
41 |
+
education = st.selectbox("Education",option=unique_education)# user's input
|
42 |
+
Marital_Status = st.selectbox("Marital_Status",option=unique_marital_status)# user's input
|
43 |
+
occupation = st.selectbox("Occupation",option=unique_occupation)# user's input
|
44 |
+
relationship = st.selectbox("Relationship",option=unique_relationship)# user's input
|
45 |
+
race = st.selectbox("Race",option=unique_race)# user's input
|
46 |
+
sex = st.selectbox("Sex",option=unique_sex)# user's input
|
47 |
+
hours_per_week = st.slider("Hours per week",min_value=1,max_value=100)# user's input
|
48 |
+
native_country = st.selectbox("Native country",option=unique_native_country# user's input
|
49 |
|
50 |
# clicked==True only when the button is clicked
|
51 |
clicked = st.form_submit_button("Predict income")
|
|
|
60 |
"sex": [sex],
|
61 |
"hours.per.week": [hours_per_week],
|
62 |
"native.country": [native_country]}))
|
|
|
63 |
|
64 |
+
if __name__="__main__":
|
65 |
+
main()
|
66 |
+
# Show prediction
|
67 |
+
result = ">50k" if result[0] == 1 else '<=50k'
|
68 |
+
st.success("Your predicted income is "+result)
|
69 |
# Run main()
|