Maha commited on
Commit
93f3ec9
·
1 Parent(s): 4a9afed

Update README

Browse files
Files changed (1) hide show
  1. README.md +12 -5
README.md CHANGED
@@ -53,12 +53,19 @@ The model will return the predicted housing value.
53
 
54
  ## Loading the Model in Python
55
  ```python
56
- from huggingface_hub import hf_hub_download
57
  import joblib
 
 
58
 
59
- model_path = hf_hub_download(repo_id="mahaqj/ml_assignment_3", filename="best_model.joblib")
60
- scaler_path = hf_hub_download(repo_id="mahaqj/ml_assignment_3", filename="scaler.joblib")
 
61
 
62
- model = joblib.load(model_path)
63
- scaler = joblib.load(scaler_path)
 
 
 
 
 
64
  ```
 
53
 
54
  ## Loading the Model in Python
55
  ```python
 
56
  import joblib
57
+ import requests
58
+ from io import BytesIO
59
 
60
+ # urls to both model and scaler
61
+ model_url = "https://huggingface.co/mahaqj/ml_assignment_3/resolve/main/best_model.joblib"
62
+ scaler_url = "https://huggingface.co/mahaqj/ml_assignment_3/resolve/main/scaler.joblib"
63
 
64
+ # download and load model
65
+ model_bytes = BytesIO(requests.get(model_url).content)
66
+ model = joblib.load(model_bytes)
67
+
68
+ # download and load scaler
69
+ scaler_bytes = BytesIO(requests.get(scaler_url).content)
70
+ scaler = joblib.load(scaler_bytes)
71
  ```