コード例 #1
0
 def _load_arbitrary_image(self, req_id):
     self.logger.trace('Will load arbitrary image.',
                       extra={'request_id': req_id})
     img_data_packed = download_data_from_remote(self.api, req_id,
                                                 self.logger)
     img_data = decode_image(img_data_packed)
     return img_data
コード例 #2
0
ファイル: rpc_servicer.py プロジェクト: ddavid/supervisely
    def _load_image_from_sly(self, req_id, image_hash, src_node_token):
        self.logger.trace('Will look for image.', extra={
            'request_id': req_id, 'image_hash': image_hash, 'src_node_token': src_node_token
        })
        img_data = self.image_cache.get(image_hash)
        if img_data is None:
            img_data_packed = download_image_from_remote(self.api, image_hash, src_node_token, self.logger)
            img_data = decode_image(img_data_packed)
            self.image_cache.add(image_hash, img_data)

        return img_data