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

[AutoPR cognitiveservices/data-plane/CustomVision/Training/cognitiveservices/data-plane/CustomVision/Prediction] Add Custom Vision 3.0 API #4646

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/services/customVision/prediction/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft
Copyright (c) 2019 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
Expand Down
100 changes: 50 additions & 50 deletions lib/services/customVision/prediction/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
---
uid: azure-cognitiveservices-customvision-prediction
summary: *content

---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
## Microsoft Azure SDK for Node.js - PredictionAPIClient

This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

### Features


### How to Install

```bash
npm install azure-cognitiveservices-customvision-prediction
```

### How to use

#### Authentication, client creation, and predictImageUrl as an example.

```javascript
const msRest = require("ms-rest");
const PredictionAPIClient = require("azure-cognitiveservices-customvision-prediction");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new PredictionAPIClient(creds, subscriptionId);
const projectId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
const imageUrl = {
url: "testurl"
};
const iterationId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
const application = "testapplication";

client.predictImageUrl(projectId, imageUrl, iterationId, application).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});
```

### Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
---
uid: azure-cognitiveservices-customvision-prediction
summary: *content
---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
## Microsoft Azure SDK for Node.js - PredictionAPIClient
This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**
### Features
### How to Install
```bash
npm install azure-cognitiveservices-customvision-prediction
```
### How to use
#### Authentication, client creation, and classifyImageUrl as an example.
```javascript
const msRest = require("ms-rest");
const PredictionAPIClient = require("azure-cognitiveservices-customvision-prediction");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new PredictionAPIClient(creds, subscriptionId);
const projectId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
const name = "testname";
const imageUrl = {
url: "testurl"
};
const application = "testapplication";
client.classifyImageUrl(projectId, name, imageUrl, application).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});
```
### Related projects
- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
11 changes: 6 additions & 5 deletions lib/services/customVision/prediction/lib/models/boundingBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
'use strict';

/**
* Class representing a BoundingBox.
* Bounding box that defines a region of an image.
*
*/
class BoundingBox {
/**
* Create a BoundingBox.
* @property {number} [left]
* @property {number} [top]
* @property {number} [width]
* @property {number} [height]
* @property {number} [left] Coordinate of the left boundary.
* @property {number} [top] Coordinate of the top boundary.
* @property {number} [width] Width.
* @property {number} [height] Height.
*/
constructor() {
}
Expand Down
117 changes: 117 additions & 0 deletions lib/services/customVision/prediction/lib/models/customVisionError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* Class representing a CustomVisionError.
*/
class CustomVisionError {
/**
* Create a CustomVisionError.
* @property {string} code The error code. Possible values include:
* 'NoError', 'BadRequest', 'BadRequestExceededBatchSize',
* 'BadRequestNotSupported', 'BadRequestInvalidIds', 'BadRequestProjectName',
* 'BadRequestProjectNameNotUnique', 'BadRequestProjectDescription',
* 'BadRequestProjectUnknownDomain',
* 'BadRequestProjectUnknownClassification',
* 'BadRequestProjectUnsupportedDomainTypeChange', 'BadRequestIterationName',
* 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription',
* 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified',
* 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName',
* 'BadRequestTagNameNotUnique', 'BadRequestTagDescription',
* 'BadRequestTagType', 'BadRequestMultipleNegativeTag',
* 'BadRequestImageTags', 'BadRequestImageRegions',
* 'BadRequestNegativeAndRegularTagOnSameImage',
* 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName',
* 'BadRequestSubscriptionApi', 'BadRequestPublishFailed',
* 'BadRequestUnpublishFailed', 'BadRequestExceedProjectLimit',
* 'BadRequestExceedIterationPerProjectLimit',
* 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit',
* 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName',
* 'BadRequestNotLimitedTrial', 'BadRequestImageBatch',
* 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat',
* 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount',
* 'BadRequestTrainingNotNeeded', 'BadRequestTrainingValidationFailed',
* 'BadRequestClassificationTrainingValidationFailed',
* 'BadRequestMultiClassClassificationTrainingValidationFailed',
* 'BadRequestMultiLabelClassificationTrainingValidationFailed',
* 'BadRequestDetectionTrainingValidationFailed',
* 'BadRequestTrainingAlreadyInProgress',
* 'BadRequestDetectionTrainingNotAllowNegativeTag',
* 'BadRequestExportValidationFailed', 'BadRequestExportAlreadyInProgress',
* 'BadRequestPredictionIdsMissing', 'BadRequestPredictionIdsExceededCount',
* 'BadRequestPredictionTagsExceededCount',
* 'BadRequestPredictionResultsExceededCount',
* 'BadRequestPredictionInvalidApplicationName',
* 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid',
* 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser',
* 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled',
* 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist',
* 'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability',
* 'ForbiddenDRModeEnabled', 'ForbiddenInvalid', 'NotFound',
* 'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration',
* 'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage',
* 'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid',
* 'Conflict', 'ConflictInvalid', 'ErrorUnknown',
* 'ErrorProjectInvalidWorkspace',
* 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain',
* 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed',
* 'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout',
* 'ErrorFeaturizationInvalidFeaturizer',
* 'ErrorFeaturizationAugmentationUnavailable',
* 'ErrorFeaturizationUnrecognizedJob',
* 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform',
* 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier',
* 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound',
* 'ErrorPredictionModelNotCached', 'ErrorPrediction',
* 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid'
* @property {string} message A message explaining the error reported by the
* service.
*/
constructor() {
}

/**
* Defines the metadata of CustomVisionError
*
* @returns {object} metadata of CustomVisionError
*
*/
mapper() {
return {
required: false,
serializedName: 'CustomVisionError',
type: {
name: 'Composite',
className: 'CustomVisionError',
modelProperties: {
code: {
required: true,
nullable: false,
serializedName: 'code',
type: {
name: 'String'
}
},
message: {
required: true,
serializedName: 'message',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = CustomVisionError;
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
'use strict';

/**
* Class representing a ImagePrediction.
* Result of an image prediction request.
*
*/
class ImagePrediction {
/**
* Create a ImagePrediction.
* @property {uuid} [id]
* @property {uuid} [project]
* @property {uuid} [iteration]
* @property {date} [created]
* @property {array} [predictions]
* @property {uuid} [id] Prediction Id.
* @property {uuid} [project] Project Id.
* @property {uuid} [iteration] Iteration Id.
* @property {date} [created] Date this prediction was created.
* @property {array} [predictions] List of predictions.
*/
constructor() {
}
Expand Down
5 changes: 3 additions & 2 deletions lib/services/customVision/prediction/lib/models/imageUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
'use strict';

/**
* Class representing a ImageUrl.
* Image url.
*
*/
class ImageUrl {
/**
* Create a ImageUrl.
* @property {string} [url]
* @property {string} [url] Url of the image.
*/
constructor() {
}
Expand Down
Loading