309309 " #print(\" [preprocess_and_decode] got %s\" % (img_str,))\n " ,
310310 " img = tf.io.decode_base64(img_str)\n " ,
311311 " img = tf.image.decode_jpeg(img, channels=1)\n " ,
312- " img = tf.image.resize_images (img, (32, 32))\n " ,
312+ " img = tf.image.resize (img, (32, 32))\n " ,
313313 " img = tf.cast(img, tf.float32)\n " ,
314314 " #img = preprocess(tf.Tensor([img]))\n " ,
315315 " return img\n " ,
316316 " \n " ,
317- " InputLayer = tf.keras.Input(shape = (1,),dtype=\" string\" )\n " ,
317+ " InputLayer = tf.keras.Input(shape = (1,),dtype=\" string\" ,name= \" input_image_bytes \" )\n " ,
318318 " OutputLayer = tf.keras.layers.Lambda(lambda img : tf.map_fn(lambda im : preprocess_and_decode(im[0]), img, dtype=\" float32\" ))(InputLayer)\n " ,
319319 " base64_model = tf.keras.Model(InputLayer, OutputLayer)\n "
320320 ]
443443 " print('\\ nAlready saved a model, cleaning up\\ n')\n " ,
444444 " !rm -r {export_path}\n " ,
445445 " \n " ,
446- " tf.saved_model.simple_save(\n " ,
447- " tf.keras.backend.get_session(),\n " ,
448- " export_path,\n " ,
449- " inputs={'input_image_bytes': model.input}, \n " ,
450- " outputs={t.name:t for t in model.outputs})\n " ,
446+ " tf.saved_model.save(model, export_path)\n " ,
451447 " \n " ,
452448 " print('\\ nSaved model:')\n " ,
453449 " !ls -l {export_path}"
533529 },
534530 "nbformat" : 4 ,
535531 "nbformat_minor" : 4
536- }
532+ }
0 commit comments