是否可以从 Google Colab 调用 Google Cloud API?
Is it possible to call Google Cloud APIs from Google Colab?
当我从 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
的另一个值)并在 link 之后给我一个 GCP 上的通用 "Failed to load" 错误。
我在网上搜索之前和之后都没有使用过 Google 云 API,找不到任何关于如何使用 Colab 启用这些 API 的示例。
编辑:
此笔记本似乎适用于 Google 翻译 API
试试这些步骤
https://colab.research.google.com/drive/1hPH7skySCZR-ZMJ6TmYLN1ug6vbq2cpb#scrollTo=2w4bHiuYXywg
当我从 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
的另一个值)并在 link 之后给我一个 GCP 上的通用 "Failed to load" 错误。
我在网上搜索之前和之后都没有使用过 Google 云 API,找不到任何关于如何使用 Colab 启用这些 API 的示例。
编辑:
此笔记本似乎适用于 Google 翻译 API
试试这些步骤
https://colab.research.google.com/drive/1hPH7skySCZR-ZMJ6TmYLN1ug6vbq2cpb#scrollTo=2w4bHiuYXywg