Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,8 +65,14 @@ def cleaning_features(data):
|
|
65 |
|
66 |
|
67 |
def pca(data):
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
one_hot_encoded = encoder.transform(data[['workclass', 'occupation']])
|
71 |
encoded_columns_df = pd.DataFrame(one_hot_encoded, columns=encoder.get_feature_names_out())
|
72 |
pca_result_net = pca_model.transform(encoded_columns_df)
|
|
|
65 |
|
66 |
|
67 |
def pca(data):
|
68 |
+
encoder_pkl = 'onehot_encoder.pkl'
|
69 |
+
pca_model_pkl = 'pca.pkl'
|
70 |
+
|
71 |
+
with open(pca_model_pkl, 'rb') as file:
|
72 |
+
pca_model = pickle.load(pca_model_pkl)
|
73 |
+
with open(encoder_pkl, 'rb') as file:
|
74 |
+
encoder = pickle.load(encoder_pkl)
|
75 |
+
|
76 |
one_hot_encoded = encoder.transform(data[['workclass', 'occupation']])
|
77 |
encoded_columns_df = pd.DataFrame(one_hot_encoded, columns=encoder.get_feature_names_out())
|
78 |
pca_result_net = pca_model.transform(encoded_columns_df)
|