使用api时报错

#5
by xuwangdeying - opened
{"error":"sentence-similarity is not a valid pipeline"}

请求:

async function query(data) {
    const response = await fetch(
        "https://api-inference.huggingface.co/models/shibing624/text2vec-base-chinese",
        {
            headers: { Authorization: "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" },
            method: "POST",
            body: JSON.stringify(data),
        }
    );
    const result = await response.json();
    return result;
}

query({"inputs": {
        "source_sentence": "That is a happy person",
        "sentences": [
            "That is a happy dog",
            "That is a very happy person",
            "Today is a sunny day"
        ]
    }}).then((response) => {
    console.log(JSON.stringify(response));
});

之前看到这个 https://discuss.huggingface.co/t/sentencesimilarityinputscheck-expected-dict-not-list-root-in-parameters/39715
似乎是README中的pipeline不对, 这个应该如何解决

shibing624 changed discussion status to closed

Sign up or log in to comment