Development¶
Principle¶
simple_tensorflow_serving
starts the HTTP server withflask
application.Load the TensorFlow models with
tf.saved_model.loader
Python API.Construct the feed_dict data from the JSON body of the request.
// Method: POST, Content-Type: application/json { "model_version": 1, // Optional "data": { "keys": [[1], [2]], "features": [[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]] } }
Use the TensorFlow Python API to
sess.run()
with feed_dict data.For multiple versions supported, it starts independent thread to load models.
For generated clients, it reads user’s model and render code with Jinja templates.
Debug¶
You can install the server with develop
and test when code changes.
git clone https://github.com/tobegit3hub/simple_tensorflow_serving
cd ./simple_tensorflow_serving/
python ./setup.py develop