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