Maha commited on
Commit ·
93f3ec9
1
Parent(s): 4a9afed
Update README
Browse files
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 |
-
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
```
|