Spaces:
Sleeping
Sleeping
mbabazif
commited on
Commit
•
f8409da
1
Parent(s):
da36e5e
App
Browse files
app.py
CHANGED
@@ -22,69 +22,76 @@ options = st.sidebar.radio("Select a page:", ["Prediction", "Model Information",
|
|
22 |
# Prediction Page
|
23 |
if options == "Prediction":
|
24 |
st.title("Income Classification - Prediction")
|
|
|
|
|
25 |
|
|
|
|
|
|
|
26 |
# Input fields
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
input_data = pd.DataFrame([[
|
89 |
age, gender, education, worker_class, marital_status, race, is_hispanic, employment_commitment,
|
90 |
employment_stat, wage_per_hour, working_week_per_year, industry_code, industry_code_main, occupation_code,
|
|
|
22 |
# Prediction Page
|
23 |
if options == "Prediction":
|
24 |
st.title("Income Classification - Prediction")
|
25 |
+
with st.form('input feature'):
|
26 |
+
# Form inputs...
|
27 |
|
28 |
+
col1, col2, col3 = st.columns(3)
|
29 |
+
|
30 |
+
with col1:
|
31 |
# Input fields
|
32 |
+
age = st.number_input("Age", min_value=0)
|
33 |
+
gender = st.selectbox("Gender", ['Female', 'Male'])
|
34 |
+
education = st.selectbox("Education", ['High School', 'Children', 'Middle School', 'Masters', 'Bachelors Degree',
|
35 |
+
'Elementary', 'College Dropout', 'Associates Degree', 'Professional Degree',
|
36 |
+
'Doctorate'])
|
37 |
+
worker_class = st.selectbox("Worker Class", ['Private', 'Federal government', 'Never worked', 'Local government',
|
38 |
+
'Self-employed-incorporated', 'Self-employed-not incorporated',
|
39 |
+
'State government', 'Without pay'])
|
40 |
+
marital_status = st.selectbox("Marital Status", ['Widowed', 'Never married', 'Married-civilian spouse present',
|
41 |
+
'Divorced', 'Married-spouse absent', 'Separated',
|
42 |
+
'Married-A F spouse present'])
|
43 |
+
race = st.selectbox("Race", ['White', 'Black', 'Asian or Pacific Islander', 'Amer Indian Aleut or Eskimo', 'Other'])
|
44 |
+
is_hispanic = st.selectbox("Is Hispanic", ['All other', 'Mexican-American', 'Central or South American',
|
45 |
+
'Mexican (Mexicano)', 'Puerto Rican', 'Other Spanish', 'Cuban',
|
46 |
+
'Do not know', 'Chicano'])
|
47 |
+
employment_commitment = st.selectbox("Employment Commitment", ['Not in labor force', 'Children or Armed Forces',
|
48 |
+
'Full-time schedules', 'PT for econ reasons usually PT',
|
49 |
+
'Unemployed full-time',
|
50 |
+
'PT for non-econ reasons usually FT',
|
51 |
+
'PT for econ reasons usually FT',
|
52 |
+
'Unemployed part- time'])
|
53 |
+
with col2:
|
54 |
+
employment_stat = st.number_input("Employment Status", min_value=0, max_value=2, step=1)
|
55 |
+
wage_per_hour = st.number_input("Wage per Hour", min_value=0)
|
56 |
+
working_week_per_year = st.number_input("Working Week per Year", min_value=0)
|
57 |
+
industry_code = st.number_input("Industry Code", min_value=0)
|
58 |
+
industry_code_main = st.selectbox("Industry Code Main", ['Not in universe or children', 'Hospital services',
|
59 |
+
'Retail trade', 'Finance insurance and real estate',
|
60 |
+
'Manufacturing-nondurable goods', 'Transportation',
|
61 |
+
'Business and repair services', 'Medical except hospital',
|
62 |
+
'Education', 'Construction', 'Manufacturing-durable goods',
|
63 |
+
'Public administration', 'Agriculture',
|
64 |
+
'Other professional services', 'Mining',
|
65 |
+
'Utilities and sanitary services', 'Private household services',
|
66 |
+
'Personal services except private HH', 'Wholesale trade',
|
67 |
+
'Communications', 'Entertainment', 'Social services',
|
68 |
+
'Forestry and fisheries', 'Armed Forces'])
|
69 |
+
occupation_code = st.number_input("Occupation Code", min_value=0)
|
70 |
+
occupation_code_main = st.selectbox("Occupation Code Main", ['Unknown', 'Adm support including clerical',
|
71 |
+
'Executive admin and managerial', 'Sales',
|
72 |
+
'Machine operators assmblrs & inspctrs', 'Other service',
|
73 |
+
'Precision production craft & repair',
|
74 |
+
'Professional specialty', 'Handlers equip cleaners etc',
|
75 |
+
'Transportation and material moving',
|
76 |
+
'Farming forestry and fishing', 'Private household services',
|
77 |
+
'Technicians and related support', 'Protective services',
|
78 |
+
'Armed Forces'])
|
79 |
+
total_employed = st.selectbox("Total Employed", [0, 1, 2, 3, 4, 5, 6])
|
80 |
+
with col3:
|
81 |
+
household_summary = st.selectbox("Household Summary", ['Householder', 'Child 18 or older',
|
82 |
+
'Child under 18 never married', 'Spouse of householder',
|
83 |
+
'Nonrelative of householder', 'Other relative of householder',
|
84 |
+
'Group Quarters- Secondary individual', 'Child under 18 ever married'])
|
85 |
+
vet_benefit = st.number_input("Vet Benefit", min_value=0, max_value=2, step=1)
|
86 |
+
tax_status = st.selectbox("Tax Status", ['Head of household', 'Single', 'Nonfiler', 'Joint both 65+',
|
87 |
+
'Joint both under 65', 'Joint one under 65 & one 65+'])
|
88 |
+
gains = st.number_input("Gains", min_value=0)
|
89 |
+
losses = st.number_input("Losses", min_value=0)
|
90 |
+
stocks_status = st.number_input("Stocks Status", min_value=0)
|
91 |
+
citizenship = st.selectbox("Citizenship", ['citizen', 'foreigner'])
|
92 |
+
importance_of_record = st.number_input("Importance of Record", min_value=0.0, format='%f')
|
93 |
+
submit_button = st.form_submit_button('Predict Income Level')
|
94 |
+
if st.button:
|
95 |
input_data = pd.DataFrame([[
|
96 |
age, gender, education, worker_class, marital_status, race, is_hispanic, employment_commitment,
|
97 |
employment_stat, wage_per_hour, working_week_per_year, industry_code, industry_code_main, occupation_code,
|