如何使用来自 API 的 TensorFlow 部署和提供预测服务?

How to deploy and serve prediction using TensorFlow from API?

从 google 教程中我们知道了如何在 TensorFlow 中训练模型。但是,保存经过训练的模型,然后在生产服务器中使用基本的最小 python api 来提供预测的最佳方法是什么。

我的问题基本上是关于 TensorFlow 最佳实践,以在不影响速度和内存问题的情况下保存模型并在实时服务器上提供预测。因为 API 服务器将永远 运行 在后台。

一小段 python 代码将不胜感激。

TensorFlow Serving is a high performance, open source serving system for machine learning models, designed for production environments and optimized for TensorFlow. The initial release contains C++ server and Python client examples based on gRPC。基本架构如下图所示。

要快速入门,请查看 tutorial