Skip to content

Commit

Permalink
fix: call correct method to upload bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Feb 7, 2023
1 parent 19b9f2d commit b957991
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions row.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,11 @@ def upload_mosaic(image, bucket_name, object_name, job_name):
bucket = storage_client.bucket(bucket_name)
new_blob = bucket.blob(str(file_name))

#: Encode image
is_success, buffer = cv2.imencode(".jpg", image)

if not is_success:
logging.error("unable to encode image: %s", object_name)

return False

with BytesIO(buffer) as data:
new_blob.upload_from_file(data.getvalue(), content_type="image/jpeg")
new_blob.upload_from_string(buffer.tobytes(), content_type="image/jpeg")

return True

0 comments on commit b957991

Please sign in to comment.