gpt4 book ai didi

python - 将 python 对象上传到 Google Cloud Storage 而不将其保存到文件

转载 作者:行者123 更新时间:2023-12-03 19:37:58 25 4
gpt4 key购买 nike

我在 Windows 10 上使用 Python 2.7 剪辑图像,并希望将它们发送到 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 管道到云存储桶而不浪费时间/空间将它们保存为中间临时对象?

最佳答案

不幸的是没有。对不起!

关于python - 将 python 对象上传到 Google Cloud Storage 而不将其保存到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45225687/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com