Skip to content

Instantly share code, notes, and snippets.

@lakshmanok
Created August 28, 2018 16:10
Show Gist options
  • Save lakshmanok/fb531a388e297637be4c8d3a83881fcc to your computer and use it in GitHub Desktop.
Save lakshmanok/fb531a388e297637be4c8d3a83881fcc to your computer and use it in GitHub Desktop.
def serving_input_fn():
# Note: only handles one image at a time
feature_placeholders = {'image_bytes':
tf.placeholder(tf.string, shape=())}
image, _ = read_and_preprocess(
tf.squeeze(feature_placeholders['image_bytes']))
features = {
'image': tf.expand_dims(image, 0)
}
return tf.estimator.export.ServingInputReceiver(features, feature_placeholders)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment