MachineLP的Github(欢迎follow):https://github.com/MachineLP
(1)克隆到本地: git clone https://github.com/tensorflow/serving.git
(2)cd到serving目录下面
(3)pip install tensorflow-serving-api
(4)运行: python tensorflow_serving/example/mnist_saved_model.py ./mnist_model (下载数据需要翻墙)
mnist_saved_model.py的代码如下:完成训练 和 模型及其变量的保存。
from __future__ import print_function
import os
import sys
# This is a placeholder for a Google-internal import.
import tensorflow as tf
import mnist_input_data
tf.app.flags.DEFINE_integer('training_iteration', 10