【问题标题】:Upload python object to Google Cloud Storage without saving it to file将 python 对象上传到 Google Cloud Storage 而不将其保存到文件
【发布时间】:2017-07-20 21:42:29
【问题描述】:

我在 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 google-cloud-storage google-cloud-python


    【解决方案1】:

    不幸的是,没有。对不起!

    【讨论】:

    • 请注意,Google Cloud Storage 确实允许从流上传,但 gcloud python 库目前不支持这样做。 boto 和 github.com/google/apitools 都支持从流上传。
    猜你喜欢
    • 1970-01-01
    • 2014-01-05
    • 2018-12-23
    • 1970-01-01
    • 1970-01-01
    • 2017-04-02
    • 2019-11-07
    • 1970-01-01
    • 2016-02-03
    相关资源
    最近更新 更多