Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
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
11 changes: 5 additions & 6 deletions lib/services/customVision/prediction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ 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://www.npmjs.com/package/@azure/cognitiveservices-customvision-prediction) which works on Node.js and browsers.**
**See https://aka.ms/azure-sdk-for-js-migration to learn more.**
**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:
Expand All @@ -21,7 +20,7 @@ npm install azure-cognitiveservices-customvision-prediction

### How to use

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

```javascript
const msRest = require("ms-rest");
Expand All @@ -30,14 +29,14 @@ 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 projectId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
const publishedName = "testpublishedName";
const imageUrl = {
url: "testurl"
};
const iterationId = "ec7b1657-199d-4d8a-bbb2-89a11a42e02a";
const application = "testapplication";

client.predictImageUrl(projectId, imageUrl, iterationId, application).then((result) => {
client.classifyImageUrl(projectId, publishedName, imageUrl, application).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down
19 changes: 10 additions & 9 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 All @@ -39,31 +40,31 @@ class BoundingBox {
className: 'BoundingBox',
modelProperties: {
left: {
required: false,
required: true,
nullable: false,
serializedName: 'left',
type: {
name: 'Number'
}
},
top: {
required: false,
required: true,
nullable: false,
serializedName: 'top',
type: {
name: 'Number'
}
},
width: {
required: false,
required: true,
nullable: false,
serializedName: 'width',
type: {
name: 'Number'
}
},
height: {
required: false,
required: true,
nullable: false,
serializedName: 'height',
type: {
Expand Down
124 changes: 124 additions & 0 deletions lib/services/customVision/prediction/lib/models/customVisionError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
* 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',
* 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName',
* 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription',
* 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified',
* 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName',
* 'BadRequestTagNameNotUnique', 'BadRequestTagDescription',
* 'BadRequestTagType', 'BadRequestMultipleNegativeTag',
* 'BadRequestImageTags', 'BadRequestImageRegions',
* 'BadRequestNegativeAndRegularTagOnSameImage',
* 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished',
* 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget',
* 'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi',
* 'BadRequestExceedProjectLimit',
* 'BadRequestExceedIterationPerProjectLimit',
* 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit',
* 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName',
* 'BadRequestNotLimitedTrial', 'BadRequestImageBatch',
* 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat',
* 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount',
* 'BadRequestTrainingNotNeeded',
* 'BadRequestTrainingNotNeededButTrainingPipelineUpdated',
* 'BadRequestTrainingValidationFailed',
* 'BadRequestClassificationTrainingValidationFailed',
* 'BadRequestMultiClassClassificationTrainingValidationFailed',
* 'BadRequestMultiLabelClassificationTrainingValidationFailed',
* 'BadRequestDetectionTrainingValidationFailed',
* 'BadRequestTrainingAlreadyInProgress',
* 'BadRequestDetectionTrainingNotAllowNegativeTag',
* 'BadRequestInvalidEmailAddress',
* 'BadRequestDomainNotSupportedForAdvancedTraining',
* 'BadRequestExportPlatformNotSupportedForAdvancedTraining',
* 'BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining',
* '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,
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 Expand Up @@ -77,7 +78,6 @@ class ImagePrediction {
},
predictions: {
required: false,
nullable: true,
readOnly: true,
serializedName: 'predictions',
type: {
Expand Down
9 changes: 5 additions & 4 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 All @@ -36,8 +37,8 @@ class ImageUrl {
className: 'ImageUrl',
modelProperties: {
url: {
required: false,
nullable: true,
required: true,
nullable: false,
serializedName: 'url',
type: {
name: 'String'
Expand Down
Loading