是否可以从Google Colab调用Google Cloud API?

时间:2019-03-05 03:34:57

标签: google-cloud-platform google-colaboratory

当我从Colab尝试时,例如

from google.cloud import translate
client = translate.Client()
client.translate("Where is the store?", target_language='zh')

我收到以下错误信息...

# Cloud Translation API has not been used in project 12345678901 before or it is disabled. 
# Enable it by visiting https://console.developers.google.com/apis/api/translate.googleapis.com/overview?project=12345678901
# then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

...(针对另一个值12345678901),并通过链接获得了GCP上的通用“无法加载”错误。

在进行一些在线搜索前后,我都没有使用过Google Cloud API。找不到关于如何通过Colab启用这些API的任何示例。

1 个答案:

答案 0 :(得分:0)

编辑:

此笔记本似乎适用于Google Translate API

尝试这些步骤

https://colab.research.google.com/drive/1hPH7skySCZR-ZMJ6TmYLN1ug6vbq2cpb#scrollTo=2w4bHiuYXywg