Skip to content

Instantly share code, notes, and snippets.

@zachrenwick
Created March 23, 2020 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachrenwick/7aaa4573ea6ca4bb38ce866e788ecb75 to your computer and use it in GitHub Desktop.
Save zachrenwick/7aaa4573ea6ca4bb38ce866e788ecb75 to your computer and use it in GitHub Desktop.
Use this to return a prediction from Azure Auto ML model deployed to ACI
import requests
import json
# URL for the web service
scoring_uri = 'http://put-your-azure-ml-uri-here.westus2.azurecontainer.io/score'
# If the service is authenticated, set the key or token
#key = '<your key or token>'
# example payload for bike share forecast future (next day)
data = {"data":
[
{
"Date":"2020-03-21",
"SUB_CHANNEL":"DTH",
"Fiscal_Month":2,
"Fiscal_Week":7,
"Fiscal_Year":2021,
}
]
}
# Convert to JSON string
input_data = json.dumps(data)
# Set the content type
headers = {'Content-Type': 'application/json'}
# If authentication is enabled, set the authorization header
#headers['Authorization'] = f'Bearer {key}'
# Make the request and display the response
resp = requests.post(scoring_uri, input_data, headers=headers)
print(resp.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment