I've got after running the code for rental bike prediction.

Parfait MOMBO 1 Reputation point

I 'm currently doing the tutorial for Azure AI Fundamentals.
At the section, "Test the deployed service", I followed the instructions as written,
but I've got <Response 502> instead of the predicted value for the bikes.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,985 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Yazeed Shaker 1 Reputation point

    I have the same problem too
    This was the code that was provided

    endpoint = 'YOUR_ENDPOINT' #Replace with your endpoint
    key = 'YOUR_KEY' #Replace with your key
    import json
    import requests
    #An array of features based on five-day weather forecast
    x = [[1,1,2022,1,0,6,0,2,0.344167,0.363625,0.805833,0.160446],
    #Convert the array to JSON format
    input_json = json.dumps({"data": x})
    #Set the content type and authentication for the request
    headers = {"Content-Type":"application/json",
            "Authorization":"Bearer " + key}
    #Send the request
    response = requests.post(endpoint, input_json, headers=headers)
    #If we got a valid response, display the predictions
    if response.status_code == 200:
        y = json.loads(response.json())
        for i in range(len(x)):
            print (" Day: {}. Predicted rentals: {}".format(i+1, max(0, round(y["result"][i]))))

  2. katherine 6 Reputation points

    I have the same problem, someone could solve it?

    0 comments No comments

  3. Fernando José Ribeiro Júnior 1 Reputation point

    I have the same problem

    0 comments No comments