Suratsada commited on
Commit
4636526
1 Parent(s): 0ec4a84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -17
app.py CHANGED
@@ -2,28 +2,19 @@ import joblib
2
  import pandas as pd
3
  import streamlit as st
4
 
5
-
6
- model = joblib.load('model.joblib')
7
- unique_values = joblib.load('unique_values.joblib')
8
-
9
- EDU_DICT = {'Partial High School': 1,
10
- 'High School': 2,
11
- 'Partial College' : 3,
12
- 'Bachelors' : 4,
13
- 'Graduate Degree' : 5}
14
-
15
  dist_dict = {'0-1 Miles' : 1,
16
  '1-2 Miles' : 2,
17
  '2-5 Miles' : 3,
18
  '5-10 Miles' : 4,
19
  '10+ Miles' : 5}
20
-
 
 
 
21
  unique_Marital_Status = unique_values["Marital Status"]
22
  unique_Gender = unique_values["Gender"]
23
- unique_Occupation = unique_values["Occupation"]
24
  unique_Home_Owner = unique_values["Home Owner"]
25
  unique_Region = unique_values["Region"]
26
- unique_Education = unique_values["Education"]
27
  unique_Commute_Distance = unique_values["Commute Distance"]
28
 
29
 
@@ -33,9 +24,8 @@ def main():
33
  with st.form("questionaire"):
34
  Marital_Status = st.selectbox("Marital Status", options=unique_Marital_Status)
35
  Gender = st.selectbox("Gender", options=unique_Gender)
36
- Education = st.selectbox("Education", options=unique_Education)
37
- Occupation = st.selectbox("Occupation", options=unique_Occupation)
38
  Home_Owner = st.selectbox("Home Owner", options=unique_Home_Owner)
 
39
  Commute_Distance = st.selectbox("Commute Distance", options=unique_Commute_Distance)
40
  Age = st.slider("Age", min_value=0, max_value=100)
41
 
@@ -45,9 +35,8 @@ def main():
45
  if clicked:
46
  result=model.predict(pd.DataFrame({"Marital Status": [Marital_Status],
47
  "Gender": [Gender],
48
- "Education": [Education],
49
- "Occupation": [Occupation],
50
  "Home Owner": [Home_Owner],
 
51
  "Commute Distance": [Commute_Distance],
52
  "Age": [Age]}))
53
  # Show prediction
 
2
  import pandas as pd
3
  import streamlit as st
4
 
 
 
 
 
 
 
 
 
 
 
5
  dist_dict = {'0-1 Miles' : 1,
6
  '1-2 Miles' : 2,
7
  '2-5 Miles' : 3,
8
  '5-10 Miles' : 4,
9
  '10+ Miles' : 5}
10
+
11
+ model = joblib.load('model.joblib')
12
+ unique_values = joblib.load('unique_values.joblib')
13
+
14
  unique_Marital_Status = unique_values["Marital Status"]
15
  unique_Gender = unique_values["Gender"]
 
16
  unique_Home_Owner = unique_values["Home Owner"]
17
  unique_Region = unique_values["Region"]
 
18
  unique_Commute_Distance = unique_values["Commute Distance"]
19
 
20
 
 
24
  with st.form("questionaire"):
25
  Marital_Status = st.selectbox("Marital Status", options=unique_Marital_Status)
26
  Gender = st.selectbox("Gender", options=unique_Gender)
 
 
27
  Home_Owner = st.selectbox("Home Owner", options=unique_Home_Owner)
28
+ Region = st.selectbox("Region", options=unique_Region)
29
  Commute_Distance = st.selectbox("Commute Distance", options=unique_Commute_Distance)
30
  Age = st.slider("Age", min_value=0, max_value=100)
31
 
 
35
  if clicked:
36
  result=model.predict(pd.DataFrame({"Marital Status": [Marital_Status],
37
  "Gender": [Gender],
 
 
38
  "Home Owner": [Home_Owner],
39
+ "Region" : [Region]
40
  "Commute Distance": [Commute_Distance],
41
  "Age": [Age]}))
42
  # Show prediction