If I am sending a JSON object to the MOE (Managed Online Endpoint) along with the binary image file, the request object will hold these values passed as raw httprequest.
payload = {"file-metadata": {
"filename": "my-image.jpg",
"file-size": "150kb",
...
}}
res = requests.post(
url=scoring_uri,
headers={"Authorization": f"Bearer {key}"},
json=payload, **attempt to pass the payload to the request**
files=[
("file", open("my-image.jpg", "rb"))
],
)
How to pass a JSON payload to this request and access that from within the scoring script? I tried to configure the json parameter to assign a sample JSON payload as above sample. However, when viewing the value through req.get_json() in the scoring script, this function returns empty.
I found a workaround to assign the payload to the headers parameter as follows. However, it would be appreciated if you may also include the correct approach/sample usage of the above class(es).
I am testing the sample https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/online/managed/online-endpoints-binary-payloads.ipynb As per the documentation, the AMLRequest and AMLResponse classes were inherited from flask.wrappers. However, please also add the parameters and attributes and sample usage of these classes.
If I am sending a JSON object to the MOE (Managed Online Endpoint) along with the binary image file, the request object will hold these values passed as raw httprequest.
How to pass a JSON payload to this request and access that from within the scoring script? I tried to configure the json parameter to assign a sample JSON payload as above sample. However, when viewing the value through req.get_json() in the scoring script, this function returns empty.
I found a workaround to assign the payload to the headers parameter as follows. However, it would be appreciated if you may also include the correct approach/sample usage of the above class(es).
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.