Last active
January 25, 2019 11:40
-
-
Save gauravkaila/ec6b12592e6c2103e8622292e83aecdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create stub | |
host, port = FLAGS.server.split(':') | |
channel = implementations.insecure_channel(host, int(port)) | |
stub = prediction_service_pb2.beta_create_PredictionService_stub(channel) | |
# Create prediction request object | |
request = predict_pb2.PredictRequest() | |
# Specify model name (must be the same as when the TensorFlow serving serving was started) | |
request.model_spec.name = 'obj_det' | |
# Initalize prediction | |
# Specify signature name (should be the same as specified when exporting model) | |
request.model_spec.signature_name = "detection_signature" | |
request.inputs['inputs'].CopyFrom( | |
tf.contrib.util.make_tensor_proto(scipy.misc.imread(FLAGS.input_image), shape=[1] + list(img.shape)) | |
# Call the prediction server | |
result = stub.Predict(request, 10.0) # 10 secs timeout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment