Returns the numpy image of the given blob_path in Cloud Providers's Blob Storage. :param blob_path: path of the cloud provider bucket to download the bytes from :return: numpy image object for the downloaded image
(self, blob_path: str)
| 223 | return byte_value |
| 224 | |
| 225 | def get_image(self, blob_path: str): |
| 226 | """ |
| 227 | Returns the numpy image of the given blob_path in Cloud Providers's Blob Storage. |
| 228 | :param blob_path: path of the cloud provider bucket to download the bytes from |
| 229 | :return: numpy image object for the downloaded image |
| 230 | """ |
| 231 | bytes_buffer = BytesIO() |
| 232 | self.s3_client.download_fileobj(Bucket = self.s3_bucket_name, Key = blob_path, Fileobj = bytes_buffer) |
| 233 | byte_value = bytes_buffer.getvalue() |
| 234 | # image_string = byte_value.decode('utf-8') # python3, default decoding is utf-8 |
| 235 | |
| 236 | image_np = imread(BytesIO(byte_value)) |
| 237 | |
| 238 | return image_np |
| 239 | |
| 240 | def build_secure_url(self, blob_name: str, expiration_offset: int = None, bucket: str = "web"): |
| 241 | """ |
no outgoing calls
no test coverage detected