简体   繁体   English

如何在 watson 对话服务中调用网络摄像头?

[英]How to invoke webcam in watson conversation service?

I'm having my Chatbot made on Watson Assistant service on IBM Cloud, and it's working fine.我在 IBM Cloud 上的 Watson Assistant 服务上制作了我的聊天机器人,它运行良好。 I have a python project that can invoke webcam for facial recognition.我有一个 python 项目,可以调用网络摄像头进行面部识别。 This process of facial recognition takes about 2.5 mins: 1- Invoking the Webcam, 2- Take the correct facial photo of the user, 3- Return the facial recognition result.这个面部识别过程大约需要2.5分钟:1-调用网络摄像头,2-拍摄用户正确的面部照片,3-返回面部识别结果。

My question is that how to invoke the webcam for the facial recognition through Watson Assistant conversation through python API on Cloud function call through Webhook?我的问题是,如何通过Watson Assistant 对话调用网络摄像头进行面部识别,通过python API on Cloud function 通过Webhook 调用? Whilst the timeout of Waston Assistant webhook is about 30 seconds? Waston Assistant webhook 的超时时间约为 30 秒?

Any help is appreciated.任何帮助表示赞赏。 Thanks谢谢

thanks for the question.谢谢你的问题。

At this point, your application may be getting too complex to build through the IBM Watson Assistant user interface.此时,您的应用程序可能变得过于复杂,无法通过 IBM Watson Assistant 用户界面构建。 Ideally when a call takes more than a few seconds to respond, you won't want to rely on an open Webhook connection, but rather have your application hosted on a server that communicates with Watson Assistant through an API.理想情况下,当呼叫响应时间超过几秒钟时,您不希望依赖开放的 Webhook 连接,而是将应用程序托管在通过 API 与 Watson Assistant 通信的服务器上。 As an example, here is the node.js integration .例如,这里是 node.js 集成

If you do want to continue to use the Watson Assistant UI, you can create a Cloud Function for your webhook that accomplishes two tasks.如果您确实想继续使用 Watson Assistant UI,您可以为完成两项任务的 Webhook 创建 Cloud Function。 One task is to start your Webcam and hand off the data to your facial recognition service, and the second can return a status of whether that service has completed successfully (and the text of the facial recognition service.)一项任务是启动您的网络摄像头并将数据传递给您的面部识别服务,第二项任务可以返回该服务是否成功完成的状态(以及面部识别服务的文本)。

Here is one way to make that work through the UI:这是通过 UI 实现该功能的一种方法:

在此处输入图像描述

So in this case we'll call our endpoint from Start Webcam, and also from our second child node.所以在这种情况下,我们将从 Start Webcam 以及我们的第二个子节点调用我们的端点。 In the middle, we'll have a delay so that we don't hammer our function too hard:在中间,我们会有一个延迟,这样我们就不会太用力地敲击我们的 function:

在此处输入图像描述

Make sure to set a variable to differentiate your status check to differentiate it from your webcam kickoff:确保设置一个变量来区分您的状态检查,以将其与您的网络摄像头启动区分开来:

在此处输入图像描述

However, the details of this will depend on what function you use for your webhook.但是,详细信息将取决于您用于 webhook 的 function。 Let me know if you have any questions about that part of the implementation.如果您对实施的那一部分有任何疑问,请告诉我。

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

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