matsammut commited on
Commit
ce3be16
·
verified ·
1 Parent(s): dd47c2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -6,6 +6,7 @@ from sklearn.preprocessing import LabelEncoder, StandardScaler, OneHotEncoder
6
  from sklearn.impute import KNNImputer
7
  from sklearn.decomposition import PCA
8
  import pickle
 
9
 
10
 
11
 
@@ -18,8 +19,9 @@ def predict(age, workclass, education, marital_status, occupation, relationship,
18
  "hours-per-week":[hours_per_week], "native-country":[native_country]}
19
  df = pd.DataFrame(data=columns)
20
  fixed_features = cleaning_features(df)
21
- with open('ann_model.pkl', 'rb') as ann_model_file:
22
- ann_model = pickle.load(ann_model_file)
 
23
  prediction = ann_model.predict(fixed_features)
24
  # prediction = 1
25
  return "Income >50K" if prediction == 1 else "Income <=50K"
 
6
  from sklearn.impute import KNNImputer
7
  from sklearn.decomposition import PCA
8
  import pickle
9
+ from tensorflow.keras.models import load_model
10
 
11
 
12
 
 
19
  "hours-per-week":[hours_per_week], "native-country":[native_country]}
20
  df = pd.DataFrame(data=columns)
21
  fixed_features = cleaning_features(df)
22
+ # with open('ann_model.pkl', 'rb') as ann_model_file:
23
+ # ann_model = pickle.load(ann_model_file)
24
+ ann_model = load_model('ann_model.h5')
25
  prediction = ann_model.predict(fixed_features)
26
  # prediction = 1
27
  return "Income >50K" if prediction == 1 else "Income <=50K"