_speech.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:aiyprojects-raspbian 作者: google 项目源码 文件源码
def do_request(self):
        """Establishes a connection and starts sending audio to the cloud
        endpoint. Responses are handled by the subclass until one returns a
        result.

        Returns:
            namedtuple with the following fields:
                transcript: string with transcript of user query
                response_audio: optionally, an audio response from the server

        Raises speech.Error on error.
        """
        try:
            service = self._make_service(self._channel_factory.make_channel())

            response_stream = self._create_response_stream(
                service, self._request_stream(), self.DEADLINE_SECS)

            if self._audio_logging_enabled:
                self._start_logging_request()

            return self._handle_response_stream(response_stream)
        except (
                google.auth.exceptions.GoogleAuthError,
                grpc.RpcError,
        ) as exc:
            raise Error('Exception in speech request') from exc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号