Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -54,13 +54,14 @@ class FeatureEngineer(BaseEstimator, TransformerMixin):
|
|
| 54 |
|
| 55 |
return X_copy
|
| 56 |
|
|
|
|
|
|
|
|
|
|
| 57 |
# Initialize Flask app with a name
|
| 58 |
app = Flask("SuperKart Sales Predictor")
|
| 59 |
|
| 60 |
# Load the trained churn prediction model
|
| 61 |
-
|
| 62 |
-
# passing the custom classes FeatureEngineer in a dictionary to the 'mmap_mode' argument.
|
| 63 |
-
model = joblib.load("XGBoostRegressor_BEST_Pipeline.joblib", mmap_mode={'FeatureEngineer': FeatureEngineer})
|
| 64 |
|
| 65 |
# Define a route for the home page
|
| 66 |
@app.get('/')
|
|
|
|
| 54 |
|
| 55 |
return X_copy
|
| 56 |
|
| 57 |
+
# This allows joblib's pickle to find the class reference it saved during training.
|
| 58 |
+
sys.modules['__main__'].FeatureEngineer = FeatureEngineer
|
| 59 |
+
|
| 60 |
# Initialize Flask app with a name
|
| 61 |
app = Flask("SuperKart Sales Predictor")
|
| 62 |
|
| 63 |
# Load the trained churn prediction model
|
| 64 |
+
model = joblib.load("XGBoostRegressor_BEST_Pipeline.joblib")
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# Define a route for the home page
|
| 67 |
@app.get('/')
|