Search code examples
jsondockerhttpgoogle-cloud-platformgoogle-cloud-automl

Getting curl: (52) Empty reply from server when trying to send a curl command to a http address of a docker running an AutoML model


I am trying to send a prediction request as a JSON to a docker image of AutoML model running on a docker container. I have exported the image from the AutoML UI and stored it in the Google Cloud Storage.

I am running the following to launch the docker image.


    CPU_DOCKER_GCS_PATH="gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest"
    YOUR_MODEL_PATH="gs://../../saved_model.pb"
    PORT=8501
    CONTAINER_NAME="my_random_name"


    sudo docker run --rm --name ${CONTAINER_NAME} -p ${PORT}:8501 -v ${YOUR_MODEL_PATH}:/tmp/mounted_model/0001 -t ${CPU_DOCKER_GCS_PATH}

when I run this command, I get the following error but the program runs.

2019-05-09 11:29:06.810470: E tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:369] FileSystemStoragePathSource encountered a file-system access error: Could not find base path /tmp/mounted_model/ for servable default

I am running the following command to send the prediction request.


    curl -d  @/home/arkanil/saved_model/cloud_output.json -X POST http://localhost:8501/v1/models/default:predict

This returns curl: (52) Empty reply from server.

I have tried to follow the steps written in the google docs mentioned below.

https://cloud.google.com/vision/automl/docs/containers-gcs-tutorial#install-docker https://docs.docker.com/install/linux/docker-ce/debian/

Getting output as curl: (52) Empty reply from server.

The expected result should be a JSON file depicting the prediction numbers of the AutoML model that is running in the docker.


Solution

  • Seems like you are trying to run with passing path of your model at google storage. You should download saved_model.pb from GS to your local computer and pass its path to YOUR_MODEL_PATH variable.

    To download model use: gsutil cp ${YOUR_MODEL_PATH} ${YOUR_LOCAL_MODEL_PATH}/saved_model.pb