Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -28,8 +28,10 @@ def cleaning_features(data):
|
|
28 |
# with open('race_onehot_encoder.pkl', 'rb') as enc_file:
|
29 |
# encoder = pickle.load(enc_file)
|
30 |
|
31 |
-
with open('
|
32 |
-
|
|
|
|
|
33 |
|
34 |
with open('scaler.pkl', 'rb') as scaler_file:
|
35 |
scaler = pickle.load(scaler_file)
|
@@ -59,8 +61,8 @@ def cleaning_features(data):
|
|
59 |
numeric_cols = ['age', 'educational-num', 'hours-per-week']
|
60 |
columns_to_encode = ['race','marital-status','relationship']
|
61 |
|
62 |
-
data['workclass'] =
|
63 |
-
data['occupation'] =
|
64 |
data['gender'] = data['gender'].map(gender_mapping)
|
65 |
data['native-country'] = data['native-country'].map(country_mapping)
|
66 |
data['educational-num'] = data['educational-num'].map(education_num_mapping)
|
|
|
28 |
# with open('race_onehot_encoder.pkl', 'rb') as enc_file:
|
29 |
# encoder = pickle.load(enc_file)
|
30 |
|
31 |
+
with open('label_encoder_work.pkl', 'rb') as le_file:
|
32 |
+
le_work = pickle.load(le_file)
|
33 |
+
with open('label_encoder_occ.pkl', 'rb') as le_file:
|
34 |
+
le_occ = pickle.load(le_file)
|
35 |
|
36 |
with open('scaler.pkl', 'rb') as scaler_file:
|
37 |
scaler = pickle.load(scaler_file)
|
|
|
61 |
numeric_cols = ['age', 'educational-num', 'hours-per-week']
|
62 |
columns_to_encode = ['race','marital-status','relationship']
|
63 |
|
64 |
+
data['workclass'] = le_work.transform(data['workclass'])
|
65 |
+
data['occupation'] = le_occ.transform(data['occupation'])
|
66 |
data['gender'] = data['gender'].map(gender_mapping)
|
67 |
data['native-country'] = data['native-country'].map(country_mapping)
|
68 |
data['educational-num'] = data['educational-num'].map(education_num_mapping)
|