Execute POST API with local filepath reference on remote machine

Viewed 13

I've 2 VM (VMA and VMB). On VMA I'm running and API for image detection (https://hub.docker.com/r/codait/max-resnet-50), I've a mount folder containing all the images I need to scan (/mnt/image/). After executing coontainer with docker run -it -p 5000:5000 quay.io/codait/max-resnet I don't have any problem running a simple POST CURL command from VMA:

curl -F "image=@/mnt/image/7aa2914d14ee4aa1a8cc243599b3270e" -XPOST http://localhost:5000/model/predict

Response:

{"status": "ok", "predictions": [{"label_id": "n03680355", "label": "car", "probability": 0.6460472941398621}, {"label_id": "n04133789", "label": "truck", "probability": 0.1919122040271759}]}

My goal is to execute the command from VMB (note that all ports are open, no network issue):

curl -F "image=@/mnt/image/7aa2914d14ee4aa1a8cc243599b3270e" -XPOST http://<VMA_IP>:5000/model/predict

I got this error:

curl: (26) Failed to open/read local data from file/application

Pls note both VMA and VMB got same rights on mount folder "/mnt/image". Is there any command/syntax I'm missing to execute correctly the POST curl?

0 Answers
Related