ComputerVisionClient Library with typescript type definitions for node.js and browser.
npm install @azure/cognitiveservices-computervisionThis package contains an isomorphic SDK for ComputerVisionClient.
- LTS versions of Node.js
- Latest versions of Safari, Chrome, Edge, and Firefox.
``bash`
npm install @azure/cognitiveservices-computervision
#### nodejs - Authentication, client creation and listModels as an example written in TypeScript.
##### Install @azure/ms-rest-azure-js
`bash`
npm install @azure/ms-rest-azure-js
##### Sample code
The following sample describes a given image using Computer Vision. To know more, refer to the Azure Documentation on Computer Vision
`javascript
const { ComputerVisionClient } = require("@azure/cognitiveservices-computervision");
const { CognitiveServicesCredentials } = require("@azure/ms-rest-azure-js");
async function main() {
const computerVisionKey = process.env["computerVisionKey"] || "
const computerVisionEndPoint =
process.env["computerVisionEndPoint"] || "
const cognitiveServiceCredentials = new CognitiveServicesCredentials(computerVisionKey);
const client = new ComputerVisionClient(cognitiveServiceCredentials, computerVisionEndPoint);
const url =
"https://docs.microsoft.com/azure/includes/media/shared-image-galleries/shared-image-gallery.png";
const options = {
maxCandidates: 5,
language: "en"
};
client
.describeImage(url, options)
.then((result) => {
console.log("The result is:");
console.log(result);
})
.catch((err) => {
console.log("An error occurred:");
console.error(err);
});
}
main();
`
#### browser - Authentication, client creation and listModels as an example written in JavaScript.
##### Sample code
- index.html
`html``