简体   繁体   English

如何使用 Flask 将使用 TensorFlow 创建的聊天机器人集成到网站中?

[英]How can I use Flask to integrate a chatbot created with TensorFlow into a website?

I have recently started developing a chat bot with Tensor Flow.我最近开始使用 Tensor Flow 开发一个聊天机器人。 I already have a model that receives a question and outputs an answer.How do I use Flask to integrate my Tensor flow chat bot model into a website?我已经有一个 model 接收问题并输出答案。如何使用 Flask 将我的张量流聊天机器人 model 集成到网站中?

Could you please help me with this by suggesting blogs or your views on the above?您能否通过建议博客或您对上述内容的看法来帮助我?

You could use Tensorflow Serving.您可以使用 Tensorflow 服务。 https://www.tensorflow.org/tfx/guide/serving https://www.tensorflow.org/tfx/guide/serving

In your backend python code, create 2 function, load() and predict()在您的后端 python 代码中,创建 2 个 function、load() 和 predict()

  1. load() can be used to load your tf model into memory, you only need to call load once for the model. load() 可用于将您的 tf model 加载到 memory 中,您只需为 model 调用一次加载。
  2. Once you get requests in from Flask, route it to call the predict() which will do the real inference with the model in load().从 Flask 收到请求后,将其路由到调用 predict(),这将使用 load() 中的 model 进行真正的推理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM