Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2901 from Azure/restapi_auto_cognitiveservices/da…
Browse files Browse the repository at this point in the history
…ta-plane/ComputerVision

[AutoPR] cognitiveservices/data-plane/ComputerVision
  • Loading branch information
Dan Schulte authored Aug 21, 2018
2 parents 6fbff02 + 332c725 commit 0513b35
Show file tree
Hide file tree
Showing 39 changed files with 1,471 additions and 646 deletions.
42 changes: 21 additions & 21 deletions lib/services/computerVision/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The MIT License (MIT)
Copyright (c) 2018 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 14 additions & 11 deletions lib/services/computerVision/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ npm install azure-cognitiveservices-computervision

```javascript
const msRestAzure = require('ms-rest-azure');
const CognitiveServicesManagement = require("azure-arm-cognitiveservices");
const CognitiveServicesManagement = require('azure-arm-cognitiveservices');
const SubscriptionId = 'your-subscription-key';
const ResourceGroup = 'your-resource-group-name';
const ResourceName = 'resource-name';
let client;
let createAccount = msRestAzure.interactiveLogin().then((credentials) => {
client = new CognitiveServicesManagement(credentials, suite.subscriptionId);
return client.accounts.create('groupname', 'accountname', {
client = new CognitiveServicesManagement(credentials, SubscriptionId);
return client.accounts.create(ResourceGroup, ResourceName, {
sku: {
name: "F0"
name: 'F0'
},
kind: "ComputerVision",
location: "westus",
kind: 'ComputerVision',
location: 'westus',
properties: {}
});
}).catch((err) => {
Expand All @@ -39,7 +42,7 @@ npm install azure-cognitiveservices-computervision
```javascript
let serviceKey;
createAccount.then((result) => {
return client.accounts.listKeys('groupname', 'accountname');
return client.accounts.listKeys(ResourceGroup, ResourceName);
}).then((result) => {
serviceKey = result.key1;
console.log(result.key2);
Expand All @@ -62,12 +65,12 @@ npm install azure-cognitiveservices-computervision
### Computer Vision API

```javascript
const ComputerVisionAPIClient = require('azure-cognitiveservices-computervision');
const ComputerVisionClient = require('azure-cognitiveservices-computervision');

let client = new ComputerVisionAPIClient(credentials);
let fileStream = fs.createReadStream('pathToSomeImage.jpg');
let client = new ComputerVisionClient(credentials, 'https://westus.api.cognitive.microsoft.com');
let fileStream = require('fs').createReadStream('pathToSomeImage.jpg');
client.analyzeImageInStreamWithHttpOperationResponse(fileStream, {
visualFeatures: ["Categories", "Tags", "Description"]
visualFeatures: ['Categories', 'Tags', 'Description']
}).then((response) => {
console.log(response.body.tags);
console.log(response.body.description.captions[0]);
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 0513b35

Please sign in to comment.