Tôi đang sử dụng Microsoft Cognitive Services api cho nútjs. Tôi đã mã sauLoạiError: cognitiveServices.face không phải là hàm tạo
const cognitiveServices = require('cognitive-services');
const face = new cognitiveServices.face({
API_KEY: yourApiKey
})
const parameters = {
returnFaceId: "true"
returnFaceLandmarks: "false"
};
const body = {
"url": "URL of input image"
};
face.detect({
parameters,
body
})
.then((response) => {
console.log('Got response', response);
})
.catch((err) => {
console.error('Encountered error making request:', err);
});
Tuy nhiên, khi tôi thực hiện đoạn mã này tôi nhận được lỗi sau
const face = new cognitiveServices.face({
^
TypeError: cognitiveServices.face is not a constructor
at Object.<anonymous> (/Users/..../face.js:3:14)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Làm thế nào tôi có thể giải quyết lỗi này?
Bạn có một yêu cầu tuyên bố ở trên cùng của mô-đun mà, phải không? Bạn có thể chỉnh sửa câu hỏi của mình để bao gồm tuyên bố đó không? Tương tự như vậy nó sẽ là tốt để xác minh rằng bạn đã cài đặt đúng api dịch vụ nhận thức cho mỗi bước Cài đặt và Bắt đầu tại https://github.com/joshbalfour/node-cognitive-services#installation. – ArthurDenture
Có Tôi có điều đó và tôi đã cập nhật câu hỏi của mình. – 2619
Xin chào, câu trả lời của tôi có phù hợp với bạn không? Tôi thấy rằng tiền thưởng vẫn còn mở ... – ArthurDenture