May 28 2020 04:09 PM
Hi,
I've tried the carpole demo, trained, then exported the BRAIN. Pull the docker to my machine, run it...
Went to locahost:5000 on my browser and it returns "Could not find a matching route". Am I doing something wrong?
Is there any example I can use to understand how to use the docker image?
Thank You!
Regards,
May 28 2020 09:21 PM - edited May 28 2020 09:22 PM
Solution
Thank you for trying the Cartpole example.
You must first run the docker image: docker run -d \ -p 5000:5000 \ --name cartpole-brain \ myworkspace.azurecr.io/bonsai/cartpole-sample:1-linux-amd64 Note as of now, only three types of process architectures are supported: 1) x64, 2) arm64v8, 3) arm32v7. Then you must test with curl on a host: curl -X GET http://localhost:5000/v1/prediction \ -d '{"cart_position": 0.0, "cart_velocity": 0.1, "pole_angle": 0.0, "pole_angular_velocity": 0.1}' Then you can test with a python script test-cartpole.py: import sys import requests __HOST = sys.argv[1] def predict(host: str, cart_position: float, cart_velocity: float, pole_angle: float, pole_angular_velocity: float) -> dict: url = "{host}/v1/prediction" state = { "cart_position": cart_position, "cart_velocity": cart_velocity, "pole_angle": pole_angle, "pole_angular_velocity": pole_angular_velocity } response = requests.get(url, json=state) action = response.json() return action action = predict(__HOST, 0.0, 0.1, 0.0, 0.1) Then you must run the python script on host: python test-cartpole.py http://localhost:5000`