仅使用 Google Speech to Text API 中的项目密钥访问位置

问题描述 投票:0回答:0

我正在做一个项目,我正在使用 Google 的 Speech to Text API。

我想为我选择的一些词分配提升值

为此我使用了 SpeechAdaption。

但这里的问题是我只有与项目关联的密钥。我没有 project_id

我可以使用这个密钥创建一个客户端

在使用自适应客户端创建自定义类时,我被要求指定将创建自定义类和短语集 ID 的父资源,如下所示

# The parent resource where the custom class and phrase set will be created.
    parent = f"projects/{project_id}/locations/{location}"

    # Create the custom class resource
    adaptation_client.create_custom_class(
        {
            "parent": parent,
            "custom_class_id": custom_class_id,
            "custom_class": {
                "items": [
                    {"value": "barrows"}
                ]
            },
        }
    )

我想知道如何使用项目密钥而不是项目 ID 来获取与项目对应的有效位置

这方面的任何帮助都会很棒

提前谢谢你!

我阅读了文档。那里提到要创建凭据。但是我无权执行任何操作。我所拥有的只是与项目相关的密钥

google-cloud-platform speech-to-text google-cloud-speech google-speech-to-text-api
© www.soinside.com 2019 - 2024. All rights reserved.