将 python 个对象上传到 Google 云存储而不将其保存到文件

Upload python object to Google Cloud Storage without saving it to file

我正在 Python 2.7 中剪辑图像 Windows 10,并想将它们发送到 Google 的 Cloud Vision API。对于本地保存的图像,我可以使用 google.cloud python 模块发送它们,如下所示:

                blob.upload_from_filename(filename=path)                        

记录在案 here

我宁愿不将每个裁剪都保存到文件中,只是为了直接发送 numpy 数组。我可以将 numpy 数组更改为 str 对象并使用

blob.upload_from_string()

但是 Cloud Vision API 将无法在我的存储桶中读取它们。有什么方法可以从 python 管道传输到云存储桶而不浪费 time/space 将它们保存为中间临时对象?

很遗憾没有。对不起!