handson-ml2 icon indicating copy to clipboard operation
handson-ml2 copied to clipboard

[BUG]chapter19 SERVER_URL = 'http://localhost:8501/v1/models/my_mnist_model:predict' is not available

Open liuyao120 opened this issue 4 years ago • 1 comments

chapter19 TensorFlow Serving

SERVER_URL = 'http://localhost:8501/v1/models/my_mnist_model:predict' is not available.

liuyao120 avatar May 08 '21 12:05 liuyao120

Hi @liuyao120 , Could you please provide more details about your system? In particular, how did you install TensorFlow Serving? Did you follow the instructions in the book for install it using Docker?

You first need to install Docker on your system. Then pull the tensorflow/serving image:

docker pull tensorflow/serving

Next, create a Docker container to run this image:

docker run -it --rm -p 8500:8500 -p 8501:8501 \
    -v "$ML_PATH/my_mnist_model:/models/my_mnist_model" \
    -e MODEL_NAME=my_mnist_model \
    tensorflow/serving

Note you should either set the ML_PATH environment variable to point to the handson-ml2 directory, or directly replace $ML_PATH with that path.

Also make sure that the my_mnist_model directory has been created in the handson-ml2 directory and it contains the model you want to serve.

Also, I'm assuming that you are running the client code on your local machine, and the docker container is running on it as well. If you run these on different machine, then you need to replace localhost with the appropriate domain name or IP address in the client code, and you must make sure that the network is configured properly (especially with regards to firewalls and routing). If the client code is running within its own docker container, you have to allow it to access the network.

Hope this helps.

ageron avatar May 11 '21 22:05 ageron