@@ -632,9 +632,6 @@ def get_image_bytes(project, image_name, variant='original'):
632632 res = response .json ()
633633 url = res [variant ]["url" ]
634634 headers = res [variant ]["headers" ]
635- print (params )
636- print (url )
637- print (headers )
638635 response = requests .get (url = url , headers = headers )
639636 if not response .ok :
640637 raise SABaseException (
@@ -800,7 +797,7 @@ def get_image_annotations(project, image_name, project_type=None):
800797 if project_type == "Pixel" :
801798 response = requests .get (
802799 url = main_annotations ["annotation_bluemap_path" ]["url" ],
803- headers = main_annotations ["annotation_bluemape_path " ]["headers" ]
800+ headers = main_annotations ["annotation_bluemap_path " ]["headers" ]
804801 )
805802 if not response .ok :
806803 raise SABaseException (
@@ -952,41 +949,31 @@ def upload_image_annotations(
952949 response .status_code , "Couldn't upload annotation. " + response .text
953950 )
954951 res = response .json ()
955- res = res ['annotation_json_path' ]
952+ res_json = res ['annotation_json_path' ]
956953 s3_session = boto3 .Session (
957- aws_access_key_id = res ['accessKeyId' ],
958- aws_secret_access_key = res ['secretAccessKey' ],
959- aws_session_token = res ['sessionToken' ]
954+ aws_access_key_id = res_json ['accessKeyId' ],
955+ aws_secret_access_key = res_json ['secretAccessKey' ],
956+ aws_session_token = res_json ['sessionToken' ]
960957 )
961958 s3_resource = s3_session .resource ('s3' )
962- bucket = s3_resource .Bucket (res ["bucket" ])
963- bucket .put_object (Key = res ['filePath' ], Body = json .dumps (annotation_json ))
959+ bucket = s3_resource .Bucket (res_json ["bucket" ])
960+ bucket .put_object (
961+ Key = res_json ['filePath' ], Body = json .dumps (annotation_json )
962+ )
964963 if project_type == "Pixel" :
965964 if mask is None :
966965 raise SABaseException (0 , "Pixel annotation should have mask." )
967966 if not isinstance (mask , io .BytesIO ):
968967 with open (mask , "rb" ) as f :
969968 mask = io .BytesIO (f .read ())
970- res_j = res ['pixel' ]
971- s3_session = boto3 .Session (
972- aws_access_key_id = res_j ['accessKeyId' ],
973- aws_secret_access_key = res_j ['secretAccessKey' ],
974- aws_session_token = res_j ['sessionToken' ]
975- )
976- s3_resource = s3_session .resource ('s3' )
977- bucket = s3_resource .Bucket (res_j ["bucket" ])
978- bucket .put_object (
979- Key = res_j ['filePath' ], Body = json .dumps (annotation_json )
980- )
981- res_m = res ['save' ]
969+ res_mask = res ['annotation_bluemap_path' ]
982970 s3_session = boto3 .Session (
983- aws_access_key_id = res_m ['accessKeyId' ],
984- aws_secret_access_key = res_m ['secretAccessKey' ],
985- aws_session_token = res_m ['sessionToken' ]
971+ aws_access_key_id = res_mask ['accessKeyId' ],
972+ aws_secret_access_key = res_mask ['secretAccessKey' ],
973+ aws_session_token = res_mask ['sessionToken' ]
986974 )
987- s3_resource = s3_session .resource ('s3' )
988- bucket = s3_resource .Bucket (res_m ["bucket" ])
989- bucket .put_object (Key = res_m ['filePath' ], Body = mask )
975+ bucket = s3_resource .Bucket (res_mask ["bucket" ])
976+ bucket .put_object (Key = res_mask ['filePath' ], Body = mask )
990977
991978
992979def create_fuse_image (
0 commit comments