Spaces:
Runtime error
Runtime error
Download model_loader.py from labhara/predictive-maintenance-app: direct link, hf CLI and curl.
- Browser
- Download file 391 Bytes
-
https://huggingface.co/spaces/labhara/predictive-maintenance-app/resolve/main/model_loader.py
- Command line
-
hf download hf://spaces/labhara/predictive-maintenance-app/model_loader.py
-
curl -L -o model_loader.py https://huggingface.co/spaces/labhara/predictive-maintenance-app/resolve/main/model_loader.py
391 Bytes
| from huggingface_hub import hf_hub_download | |
| import joblib | |
| def load_model(): | |
| # Download model file from Hugging Face Model Hub | |
| model_path = hf_hub_download( | |
| repo_id="labhara/predictive-maintenance-bestmodel", | |
| filename="GradientBoosting_model.pkl" | |
| ) | |
| model = joblib.load(model_path) | |
| model.expected_features = list(model.feature_names_in_) | |
| return model | |