app.py 文件源码

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

项目:async_face_recognition 作者: dpdornseifer 项目源码 文件源码
def _returnfaces(self, request):
        ''' returnes the processed images with the detected artifacts highlighted '''
        try:

            image = yield from self._getlastimage()

            image_buf = cv2.imencode('.jpg', image)[1]
            image_str = np.array(image_buf).tostring()

        except asyncio.QueueEmpty as qe:
            msg = 'QueueEmpty exception has been thrown. There is no image ' \
                  'with some recognized artifacts in the queue right now.'
            self._logger.warning(msg)
            return Response(
                text=msg,
                status=500,
                content_type='application/json'
            )


        return Response(
            body=image_str,
            status=200,
            content_type='image/jpeg'
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号