我正在从Google存储空间下载一个字节字符串的文件,对其进行b64编码,然后将其用作Google Vision API的输入。
storage_client = storage.Client(project=[PROJECT])
bucket = storage_client.get_bucket([BUCKET])
blob = bucket.blob([KEY])
content = blob.download_as_string()
b64content = base64.b64encode(content)
client = vision.ImageAnnotatorClient()
image = vision.types.Image(content=b64content)
使用b64content时出现错误的图像错误。但是,如果我使用非base64内容,则对Vision API的调用将成功:
image = vision.types.Image(content=content)
blob.download_as_string()是否返回已进行base64编码的字节字符串?