An Azure machine learning service for building and deploying models.
After deploying getting error 502 while generating forecast in Azure Ml through Code
Singh, Rajeev
6
Reputation points
Hi,
After doing the deployment task, i am not able to generate the forecast through code pipeline of Azure Ml.
this is my run.py file:
def run(df, url, api_key):
allowSelfSignedHttps(True)
if api_key == 'uu':
api_key = ''
data = []
for index, row in list(df.iterrows()):
data.append(dict(row))
data = {
"data": data
}
body = str.encode(json.dumps(data))
headers = {'Content-Type': 'application/json',
'Authorization': ('Bearer ' + api_key)}
req = urllib.request.Request(url, body, headers)
print(url, api_key)
try:
response = urllib.request.urlopen(req)
result = response.read()
print(result)
except urllib.error.HTTPError as error:
print("The request failed with status code: " + str(error.code))
# Print the headers - they include the requert ID and the timestamp, which are useful for debugging the failure
print(error.info())
# print(json.loads(error.read().decode("utf8", 'ignore')))
data = json.loads(json.load(response))
df= pd.json_normalize(data[result])
data = data.get('forecast', None)
return data
Error: 502
Azure Machine Learning
Azure Machine Learning
Azure Lab Services
Azure Lab Services
An Azure service that is used to set up labs for classrooms, trials, development and testing, and other scenarios.
Sign in to answer