Spaces:
Runtime error
Runtime error
Upload model_loader.py
Browse files- model_loader.py +12 -0
model_loader.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import hf_hub_download
|
| 2 |
+
import joblib
|
| 3 |
+
|
| 4 |
+
def load_model():
|
| 5 |
+
# Download model file from Hugging Face Model Hub
|
| 6 |
+
model_path = hf_hub_download(
|
| 7 |
+
repo_id="labhara/predictive-maintenance-bestmodel",
|
| 8 |
+
filename="GradientBoosting_model.pkl"
|
| 9 |
+
)
|
| 10 |
+
model = joblib.load(model_path)
|
| 11 |
+
model.expected_features = list(model.feature_names_in_)
|
| 12 |
+
return model
|