java.lang.RuntimeException: Unexpected code Response{protocol=http/1.1, code=400, message=Bad Request, url=http://localhost:8501/v1/models/myfruit:predict} #2215
Labels
stale
This label marks the issue/pr stale - to be closed automatically if no activity
stat:awaiting response
type:bug
System information
operating system:
win11 64bit
tensorflow/serving version:
2.14.1
TFserving Deployment mode:
RESTful API
python requirements.txt:
tensorflow-cpu == 2.3.0 pyqt5 pillow opencv-python matplotlib
Describe the problem
Hello everyone, my demand is to build an interface with java, the front-end transmits an arbitrary image, java uses
tensorflow for java
ortensorflow serving
to use the model to make predictions, java gets the prediction results and returns to the front-end.Now I am ready to experiment with python to train the model, save the model as saved_model, and then set up tensorflow serving. Now the local docker container has been successfully started.
The python code for model training is copied online, and the specific code is as follows:
The model training is also trained, and it is predictable in the python version using the h5 format. The model information is as follows:
java as the client request code:
java is having trouble making requests to
tensorflow serving
and is not sure what to do. The error is as follows:java.lang.RuntimeException: Unexpected code Response{protocol=http/1.1, code=400, message=Bad Request, url=http://localhost:8501/v1/models/myfruit:predict}
Look at https://tensorflow.google.cn/tfx/serving/api_rest#classify_and_regress_api here document as is can use base64 as parameters.
I tried the following formats, all failed, all reported similar to 400 errors
I am a java novice, tensorflow is also a novice, a lot of operations, basic terminology is not clear, do not know what knowledge is missing. Thank you for your generous advice. Do the parameters in sensory model training have a strong relationship with tfserving entry here? How do I organize parameters?
The text was updated successfully, but these errors were encountered: