如何解决Google云平台翻译API项目问题
我在使用Google Cloud Platform Translation API时遇到问题,我只想在将其用于数据集之前对其进行测试。我不断收到此错误:
InvalidArgument:400个无效的“父母”。无效的资源名称项目ID。标识符必须以字母开头。资源类型:位置
# -*- coding: utf-8 -*-
from google.cloud import translate_v3
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] =
r"C:\Users\manu_\OneDrive\Desktop\translate\translationAPI\GoogleCloudKEY.json"
translate_client = translate_v3.TranslationServiceClient()
text = 'Hello,how are you ?'
target = 'ru'
parent = translate_client.location_path('[projects/{my_project_id}]','[projects/{albatrosscx}/locations/{asia-est1 (Taiwan)}]')
output = translate_client.translate_text(text,target,parent)
print(output)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。