Node.js 无法使用API密钥进行身份验证

Node.js 无法使用API密钥进行身份验证,node.js,clarifai,Node.js,Clarifai,我正在尝试使用Node.js的服装检测模型。我一直遇到两个错误。 我收到的第一个错误是: 无效的API密钥或无效的API密钥/应用程序对 根据此代码创建: const grpc = require("@grpc/grpc-js"); const stub=ClarifaiStub.grpc(); const metadata = new grpc.Metadata(); metadata.set("authorization", "Key xx

我正在尝试使用Node.js的服装检测模型。我一直遇到两个错误。 我收到的第一个错误是:

无效的API密钥或无效的API密钥/应用程序对

根据此代码创建:

const grpc = require("@grpc/grpc-js");

const stub=ClarifaiStub.grpc();
const metadata = new grpc.Metadata();
metadata.set("authorization", "Key xxxxxxxxxxxxxxxxxxxxxxxxxxx");

stub.PostModelOutputs(
    {
        model_id: "72c523807f93e18b431676fb9a58e6ad",
        version_id: "1ed35c3d176f45d69d2aa7971e6ab9fe",  // This is optional. Defaults to the latest model version.
        inputs: [
            {data: {image: {url: "https://sc01.alicdn.com/kf/HTB1VxCwKFXXXXXeaXXXq6xXFXXX1.jpg"}}}
        ]
    },
    metadata,
    (err, response) => {
        if (err) {
            throw new Error(err);
        }

        if (response.status.code !== 10000) {
            throw new Error("Post model outputs failed, status: " + response.status.description);
        }

        // Since we have one input, one output will exist here.
        const output = response.outputs[0];

        console.log("Predicted concepts:");
        for (const concept of output.data.concepts) {
            console.log(concept.name + " " + concept.value);
        }
    }
);
我遇到的第二个问题是尝试为此应用程序创建工作流时遇到的问题。选择服装模型并单击“创建工作流”时,我收到以下消息:

您的请求被阻止。缺少特征标志:[模型视觉检测器]


我收到的信息与我尝试过的不同型号/型号组合相同。很抱歉问了这么多问题,我现在感到很困惑。感谢您的帮助。

使用您的API密钥,我能够成功地调用模型。但是,我省略了version\u id字段。看起来这个版本id不正确(如果省略它,那么它将只获得模型的最新版本)

我屏蔽了你的密钥(包括答案),因为你通常不想公开分享

const grpc = require("@grpc/grpc-js");

const stub=ClarifaiStub.grpc();
const metadata = new grpc.Metadata();
metadata.set("authorization", "Key xxxxxxxxxxxxxxxxxxxxxxxxxxx");

stub.PostModelOutputs(
    {
        model_id: "72c523807f93e18b431676fb9a58e6ad",
        inputs: [
            {data: {image: {url: "https://sc01.alicdn.com/kf/HTB1VxCwKFXXXXXeaXXXq6xXFXXX1.jpg"}}}
        ]
    },
    metadata,
    (err, response) => {
        if (err) {
            throw new Error(err);
        }

        if (response.status.code !== 10000) {
            throw new Error("Post model outputs failed, status: " + response.status.description);
        }

        // Since we have one input, one output will exist here.
        const output = response.outputs[0];

        console.log("Predicted concepts:");
        for (const concept of output.data.concepts) {
            console.log(concept.name + " " + concept.value);
        }
    }
);