Spaces:
Build error
Build error
Download model_predictor.py from Abhi10000/AMCPREDICTAPP: direct link, hf CLI and curl.
- Browser
- Download file 384 Bytes
-
https://huggingface.co/spaces/Abhi10000/AMCPREDICTAPP/resolve/main/model_predictor.py
- Command line
-
hf download hf://spaces/Abhi10000/AMCPREDICTAPP/model_predictor.py
-
curl -L -o model_predictor.py https://huggingface.co/spaces/Abhi10000/AMCPREDICTAPP/resolve/main/model_predictor.py
384 Bytes
| from joblib import load | |
| from datetime import datetime, timedelta | |
| model = load("amc_model.pkl") | |
| def predict_next_service(last_service_date): | |
| today = datetime.today() | |
| delta_days = (today - datetime.strptime(last_service_date, "%Y-%m-%d")).days | |
| predicted_days = int(model.predict([[delta_days]])[0]) | |
| return (today + timedelta(days=predicted_days)).strftime("%Y-%m-%d") | |