简体   繁体   English

如何在Google App Engine Python中使用Google Cloud Vision?

[英]How to use google cloud vision with Google App Engine Python?

I am trying to use https://cloud.google.com/vision/ in my Google App Engine Python application. 我正在尝试在我的Google App Engine Python应用程序中使用https://cloud.google.com/vision/ Are there examples for using it? 有使用示例吗?

I followed the tutorial: https://www.programmableweb.com/news/how-to-build-monitoring-application-google-cloud-vision-api/how-to/2016/03/29?page=4 我遵循了该教程: https : //www.programmableweb.com/news/how-to-build-monitoring-application-google-cloud-vision-api/how-to/2016/03/29?page=4

and

I am getting an error when I use the following after enabling the Cloud-Vision API in the API manager: 在API管理器中启用Cloud-Vision API后,使用以下命令时出现错误:

from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials

Error 错误

   from googleapiclient.discovery import build
ImportError: No module named googleapiclient.discovery

Am I missing a dependency configuration? 我是否缺少依赖项配置?

You should be able to use their official client libraries in your app engine project like any other API. 您应该能够像其他任何API一样在您的App Engine项目中使用其官方客户端库。 Just make sure to enable the specific API for your specific project in the API Manager [0]. 只需确保在API管理器[0]中为特定项目启用了特定API。

There's also a repo with sample code for various languages although not app engine specific [1] 虽然不是特定于应用程序引擎的,但也有一个包含各种语言的示例代码的回购库[1]

Accessing Google APIs from Python 从Python访问Google API

For your App Engine project, run this to install the client library first. 对于您的App Engine项目,请运行此程序以首先安装客户端库。 This is considered a third party library, so you will need some initial setup for your app engine project as described here [2] - 这被视为第三方库,因此您将需要对App Engine项目进行一些初始设置,如此处所述[2]-

$ mkdir lib
$ pip install --upgrade -t lib google-api-python-client

Create a file appengine_config.py with the following content - 创建具有以下内容的文件appengine_config.py

# appengine_config.py
from google.appengine.ext import vendor

# Add any libraries install in the "lib" folder.
vendor.add('lib')

You can find more information about the client library here - 您可以在此处找到有关客户端库的更多信息-

https://developers.google.com/api-client-library/python/ https://developers.google.com/api-client-library/python/

Feel free to update your question with more specific issues you are having including some sample code you've tried and I'd be happy to provide more assistance. 随时用您遇到的更具体的问题来更新您的问题,包括您尝试过的一些示例代码,我们很乐意提供更多帮助。

[0] https://console.cloud.google.com/apis/api/vision.googleapis.com/overview [0] https://console.cloud.google.com/apis/api/vision.googleapis.com/overview

[1] https://github.com/GoogleCloudPlatform/cloud-vision [1] https://github.com/GoogleCloudPlatform/cloud-vision

[2] https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#vendoring [2] https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#vendoring

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Google App Engine (python) 中导入 Google Cloud 语音识别 - How to import google cloud speech recognition in Google App Engine (python) Google Cloud Vision API - Python - Google Cloud Vision API - Python 如何停止谷歌云应用引擎重新启动 discord.python 机器人? - How to stop google cloud app engine to restart the discord python bot? 如何在 App Engine Python 上创建 Google Cloud Storage 签名 URL - How to Create Google Cloud Storage Signed Urls on App Engine Python 带有python的Google App Engine数据存储标签云 - Google app engine datastore tag cloud with python 在Google App / Cloud Engine中避免使用Python全局变量 - Avoiding Python globals in Google App/Cloud Engine 如何在python程序中使用Google Vision API? - How to use Google Vision API in python program? 如何使用正确的 Vision API 凭据获取 Google App Engine? - How to get Google App Engine using proper credentials for Vision API? 如何使用 python 使用本地图像查询 Google Cloud Vision API? - How to Query the Google Cloud Vision API with a local image using python? 如何在 python 脚本内的云上验证谷歌视觉 API? - How to authenticate a google vision API on cloud inside a python script?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM