Пример #1
0
    def detect(self, det, ctx):
        """Detect determines which endpoint to used based on the request type"""

        type = det.WhichOneof("request")
        if type == "img_manip_req":
            req = det.img_manip_req
            resp = self._CallEndpoint(self.IMAGE_MANIPULATION, req,
                                      analytic_pb2.ImageManipulation(), ctx)
            det.img_manip.CopyFrom(resp)
        elif type == "vid_manip_req":
            req = det.vid_manip_req
            resp = self._CallEndpoint(self.VIDEO_MANIPULATION, req,
                                      analytic_pb2.VideoManipulation(), ctx)
            det.vid_manip.CopyFrom(resp)
        elif type == "img_splice_req":
            req = det.img_splice_req
            resp = self._CallEndpoint(self.IMAGE_SPLICE, req,
                                      analytic_pb2.ImageSplice(), ctx)
            det.CopyFrom(resp)
        elif type == "img_cam_match_req":
            req = det.img_cam_match_req
            resp = self._CallEndpoint(self.IMAGE_CAMERA_MATCH, req,
                                      analytic_pb2.ImageCameraMatch(), ctx)
            det.CopyFrom(resp)

        return det
Пример #2
0
 def DetectImageManipulation(self, req, ctx):
     return self.svc._CallEndpoint(self.svc.IMAGE_MANIPULATION, req,
                                   analytic_pb2.ImageManipulation(), ctx)