Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,15 +6,16 @@ from sklearn.preprocessing import LabelEncoder, StandardScaler, OneHotEncoder
|
|
| 6 |
from sklearn.impute import KNNImputer
|
| 7 |
|
| 8 |
# Load your saved model
|
| 9 |
-
model = joblib.load("ann_model.joblib")
|
| 10 |
|
| 11 |
# # Define the prediction function
|
| 12 |
def predict(age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country):
|
| 13 |
features = [age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country]
|
| 14 |
fixed_features = cleaning_features(features)
|
| 15 |
-
prediction = model.predict(features)
|
| 16 |
-
prediction = 1
|
| 17 |
-
return "Income >50K" if prediction == 1 else "Income <=50K"
|
|
|
|
| 18 |
|
| 19 |
def cleaning_features(data):
|
| 20 |
le = LabelEncoder()
|
|
|
|
| 6 |
from sklearn.impute import KNNImputer
|
| 7 |
|
| 8 |
# Load your saved model
|
| 9 |
+
# model = joblib.load("ann_model.joblib")
|
| 10 |
|
| 11 |
# # Define the prediction function
|
| 12 |
def predict(age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country):
|
| 13 |
features = [age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country]
|
| 14 |
fixed_features = cleaning_features(features)
|
| 15 |
+
# prediction = model.predict(features)
|
| 16 |
+
# prediction = 1
|
| 17 |
+
# return "Income >50K" if prediction == 1 else "Income <=50K"
|
| 18 |
+
return fixed_features
|
| 19 |
|
| 20 |
def cleaning_features(data):
|
| 21 |
le = LabelEncoder()
|