Skip to content

Commit 2d1eaf3

Browse files
committed
fix: requests
1 parent f3b00e3 commit 2d1eaf3

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

articles/machine-learning/how-to-deploy-mlflow-models-online-progressive.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The workspace is the top-level resource for Azure Machine Learning, providing a
7979
```python
8080
import json
8181
import mlflow
82-
import urllib.request
82+
import requests
8383
import pandas as pd
8484
from mlflow.deployments import get_deploy_client
8585
```
@@ -198,7 +198,12 @@ We are going to exploit this functionality by deploying multiple versions of the
198198
We can configure the properties of this endpoint using a configuration file. In this case, we are configuring the authentication mode of the endpoint to be "key".
199199
200200
```python
201-
endpoint_config = {"auth_mode": "key"}
201+
endpoint_config = {
202+
"auth_mode": "key",
203+
"identity": {
204+
"type": "system_assigned"
205+
}
206+
}
202207
```
203208
204209
Let's write this configuration into a `JSON` file:
@@ -308,6 +313,9 @@ So far, the endpoint is empty. There are no deployments on it. Let's create the
308313
}
309314
```
310315
316+
> [!NOTE]
317+
> The full specification of this configuration can be found at [Managed online deployment schema (v2)](reference-yaml-deployment-managed-online.md).
318+
311319
Write the configuration to a file:
312320
313321
```python
@@ -404,9 +412,7 @@ So far, the endpoint is empty. There are no deployments on it. Let's create the
404412
.reset_index(drop=True)
405413
)
406414
407-
sample_request = json.dumps(
408-
{"input_data": json.loads(samples.to_json(orient="split", index=False))}
409-
)
415+
sample_request = { "input_data": json.loads(samples.to_json(orient="split", index=False)) }
410416
```
411417
412418
1. Test the deployment
@@ -447,11 +453,8 @@ So far, the endpoint is empty. There are no deployments on it. Let's create the
447453
Call the endpoint and its default deployment:
448454
449455
```python
450-
req = urllib.request.Request(scoring_uri, sample_request, headers)
451-
response = urllib.request.urlopen(req)
452-
453-
result = response.read()
454-
print(result)
456+
req = requests.post(scoring_uri, json=sample_request, headers=headers)
457+
req.json()
455458
```
456459
457460
### Create a green deployment under the endpoint

0 commit comments

Comments
 (0)