diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py index 17c83361819f..da2695822d5b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py @@ -33,7 +33,7 @@ def __init__( raise ValueError("Parameter 'endpoint' must not be None.") if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") - base_url = '{Endpoint}/customvision/v3.0/prediction' + base_url = '{Endpoint}/customvision/v3.1/prediction' super(CustomVisionPredictionClientConfiguration, self).__init__(base_url) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py index abfb4a51227f..74d0c50ec5cf 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py @@ -37,7 +37,7 @@ def __init__( super(CustomVisionPredictionClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '3.0' + self.api_version = '3.1' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py index d654981d00aa..3ec9e2927bba 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py @@ -23,6 +23,7 @@ from ._models import Prediction from ._custom_vision_prediction_client_enums import ( CustomVisionErrorCodes, + TagType, ) __all__ = [ @@ -32,4 +33,5 @@ 'ImageUrl', 'Prediction', 'CustomVisionErrorCodes', + 'TagType', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py index cf908ce921ee..2282b02c977c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py @@ -26,10 +26,13 @@ class CustomVisionErrorCodes(str, Enum): bad_request_project_unknown_classification = "BadRequestProjectUnknownClassification" bad_request_project_unsupported_domain_type_change = "BadRequestProjectUnsupportedDomainTypeChange" bad_request_project_unsupported_export_platform = "BadRequestProjectUnsupportedExportPlatform" + bad_request_project_image_preprocessing_settings = "BadRequestProjectImagePreprocessingSettings" + bad_request_project_duplicated = "BadRequestProjectDuplicated" bad_request_iteration_name = "BadRequestIterationName" bad_request_iteration_name_not_unique = "BadRequestIterationNameNotUnique" bad_request_iteration_description = "BadRequestIterationDescription" bad_request_iteration_is_not_trained = "BadRequestIterationIsNotTrained" + bad_request_iteration_validation_failed = "BadRequestIterationValidationFailed" bad_request_workspace_cannot_be_modified = "BadRequestWorkspaceCannotBeModified" bad_request_workspace_not_deletable = "BadRequestWorkspaceNotDeletable" bad_request_tag_name = "BadRequestTagName" @@ -37,14 +40,17 @@ class CustomVisionErrorCodes(str, Enum): bad_request_tag_description = "BadRequestTagDescription" bad_request_tag_type = "BadRequestTagType" bad_request_multiple_negative_tag = "BadRequestMultipleNegativeTag" + bad_request_multiple_general_product_tag = "BadRequestMultipleGeneralProductTag" bad_request_image_tags = "BadRequestImageTags" bad_request_image_regions = "BadRequestImageRegions" bad_request_negative_and_regular_tag_on_same_image = "BadRequestNegativeAndRegularTagOnSameImage" + bad_request_unsupported_domain = "BadRequestUnsupportedDomain" bad_request_required_param_is_null = "BadRequestRequiredParamIsNull" bad_request_iteration_is_published = "BadRequestIterationIsPublished" bad_request_invalid_publish_name = "BadRequestInvalidPublishName" bad_request_invalid_publish_target = "BadRequestInvalidPublishTarget" bad_request_unpublish_failed = "BadRequestUnpublishFailed" + bad_request_iteration_not_published = "BadRequestIterationNotPublished" bad_request_subscription_api = "BadRequestSubscriptionApi" bad_request_exceed_project_limit = "BadRequestExceedProjectLimit" bad_request_exceed_iteration_per_project_limit = "BadRequestExceedIterationPerProjectLimit" @@ -58,6 +64,7 @@ class CustomVisionErrorCodes(str, Enum): bad_request_image_url = "BadRequestImageUrl" bad_request_image_format = "BadRequestImageFormat" bad_request_image_size_bytes = "BadRequestImageSizeBytes" + bad_request_image_dimensions = "BadRequestImageDimensions" bad_request_image_exceeded_count = "BadRequestImageExceededCount" bad_request_training_not_needed = "BadRequestTrainingNotNeeded" bad_request_training_not_needed_but_training_pipeline_updated = "BadRequestTrainingNotNeededButTrainingPipelineUpdated" @@ -80,6 +87,13 @@ class CustomVisionErrorCodes(str, Enum): bad_request_prediction_results_exceeded_count = "BadRequestPredictionResultsExceededCount" bad_request_prediction_invalid_application_name = "BadRequestPredictionInvalidApplicationName" bad_request_prediction_invalid_query_parameters = "BadRequestPredictionInvalidQueryParameters" + bad_request_invalid_import_token = "BadRequestInvalidImportToken" + bad_request_export_while_training = "BadRequestExportWhileTraining" + bad_request_image_metadata_key = "BadRequestImageMetadataKey" + bad_request_image_metadata_value = "BadRequestImageMetadataValue" + bad_request_operation_not_supported = "BadRequestOperationNotSupported" + bad_request_invalid_artifact_uri = "BadRequestInvalidArtifactUri" + bad_request_customer_managed_key_revoked = "BadRequestCustomerManagedKeyRevoked" bad_request_invalid = "BadRequestInvalid" unsupported_media_type = "UnsupportedMediaType" forbidden = "Forbidden" @@ -105,10 +119,13 @@ class CustomVisionErrorCodes(str, Enum): conflict = "Conflict" conflict_invalid = "ConflictInvalid" error_unknown = "ErrorUnknown" + error_iteration_copy_failed = "ErrorIterationCopyFailed" + error_prepare_performance_migration_failed = "ErrorPreparePerformanceMigrationFailed" error_project_invalid_workspace = "ErrorProjectInvalidWorkspace" error_project_invalid_pipeline_configuration = "ErrorProjectInvalidPipelineConfiguration" error_project_invalid_domain = "ErrorProjectInvalidDomain" error_project_training_request_failed = "ErrorProjectTrainingRequestFailed" + error_project_import_request_failed = "ErrorProjectImportRequestFailed" error_project_export_request_failed = "ErrorProjectExportRequestFailed" error_featurization_service_unavailable = "ErrorFeaturizationServiceUnavailable" error_featurization_queue_timeout = "ErrorFeaturizationQueueTimeout" @@ -125,4 +142,12 @@ class CustomVisionErrorCodes(str, Enum): error_prediction = "ErrorPrediction" error_prediction_storage = "ErrorPredictionStorage" error_region_proposal = "ErrorRegionProposal" + error_unknown_base_model = "ErrorUnknownBaseModel" error_invalid = "ErrorInvalid" + + +class TagType(str, Enum): + + regular = "Regular" + negative = "Negative" + general_product = "GeneralProduct" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py index 6c4860c8748c..b245eba70734 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py @@ -62,25 +62,29 @@ class CustomVisionError(Model): 'BadRequestProjectUnknownDomain', 'BadRequestProjectUnknownClassification', 'BadRequestProjectUnsupportedDomainTypeChange', - 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', + 'BadRequestProjectUnsupportedExportPlatform', + 'BadRequestProjectImagePreprocessingSettings', + 'BadRequestProjectDuplicated', 'BadRequestIterationName', 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', - 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified', - 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', - 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', - 'BadRequestTagType', 'BadRequestMultipleNegativeTag', + 'BadRequestIterationIsNotTrained', 'BadRequestIterationValidationFailed', + 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', + 'BadRequestTagName', 'BadRequestTagNameNotUnique', + 'BadRequestTagDescription', 'BadRequestTagType', + 'BadRequestMultipleNegativeTag', 'BadRequestMultipleGeneralProductTag', 'BadRequestImageTags', 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', - 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', - 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', - 'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi', + 'BadRequestUnsupportedDomain', 'BadRequestRequiredParamIsNull', + 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', + 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', + 'BadRequestIterationNotPublished', 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat', - 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', - 'BadRequestTrainingNotNeeded', + 'BadRequestImageSizeBytes', 'BadRequestImageDimensions', + 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', @@ -98,7 +102,11 @@ class CustomVisionError(Model): 'BadRequestPredictionTagsExceededCount', 'BadRequestPredictionResultsExceededCount', 'BadRequestPredictionInvalidApplicationName', - 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', + 'BadRequestPredictionInvalidQueryParameters', + 'BadRequestInvalidImportToken', 'BadRequestExportWhileTraining', + 'BadRequestImageMetadataKey', 'BadRequestImageMetadataValue', + 'BadRequestOperationNotSupported', 'BadRequestInvalidArtifactUri', + 'BadRequestCustomerManagedKeyRevoked', 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', @@ -107,19 +115,20 @@ class CustomVisionError(Model): 'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid', - 'Conflict', 'ConflictInvalid', 'ErrorUnknown', - 'ErrorProjectInvalidWorkspace', + 'Conflict', 'ConflictInvalid', 'ErrorUnknown', 'ErrorIterationCopyFailed', + 'ErrorPreparePerformanceMigrationFailed', 'ErrorProjectInvalidWorkspace', 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', - 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', - 'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout', - 'ErrorFeaturizationInvalidFeaturizer', + 'ErrorProjectTrainingRequestFailed', 'ErrorProjectImportRequestFailed', + 'ErrorProjectExportRequestFailed', 'ErrorFeaturizationServiceUnavailable', + 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', 'ErrorFeaturizationAugmentationUnavailable', 'ErrorFeaturizationUnrecognizedJob', 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', - 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorUnknownBaseModel', + 'ErrorInvalid' :type code: str or ~azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorCodes :param message: Required. A message explaining the error reported by the @@ -236,6 +245,10 @@ class Prediction(Model): :ivar bounding_box: Bounding box of the prediction. :vartype bounding_box: ~azure.cognitiveservices.vision.customvision.prediction.models.BoundingBox + :ivar tag_type: Type of the predicted tag. Possible values include: + 'Regular', 'Negative', 'GeneralProduct' + :vartype tag_type: str or + ~azure.cognitiveservices.vision.customvision.prediction.models.TagType """ _validation = { @@ -243,6 +256,7 @@ class Prediction(Model): 'tag_id': {'readonly': True}, 'tag_name': {'readonly': True}, 'bounding_box': {'readonly': True}, + 'tag_type': {'readonly': True}, } _attribute_map = { @@ -250,6 +264,7 @@ class Prediction(Model): 'tag_id': {'key': 'tagId', 'type': 'str'}, 'tag_name': {'key': 'tagName', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'}, + 'tag_type': {'key': 'tagType', 'type': 'str'}, } def __init__(self, **kwargs): @@ -258,3 +273,4 @@ def __init__(self, **kwargs): self.tag_id = None self.tag_name = None self.bounding_box = None + self.tag_type = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py index a7ef53998a0a..b9313dc78ab4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py @@ -62,25 +62,29 @@ class CustomVisionError(Model): 'BadRequestProjectUnknownDomain', 'BadRequestProjectUnknownClassification', 'BadRequestProjectUnsupportedDomainTypeChange', - 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', + 'BadRequestProjectUnsupportedExportPlatform', + 'BadRequestProjectImagePreprocessingSettings', + 'BadRequestProjectDuplicated', 'BadRequestIterationName', 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', - 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified', - 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', - 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', - 'BadRequestTagType', 'BadRequestMultipleNegativeTag', + 'BadRequestIterationIsNotTrained', 'BadRequestIterationValidationFailed', + 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', + 'BadRequestTagName', 'BadRequestTagNameNotUnique', + 'BadRequestTagDescription', 'BadRequestTagType', + 'BadRequestMultipleNegativeTag', 'BadRequestMultipleGeneralProductTag', 'BadRequestImageTags', 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', - 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', - 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', - 'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi', + 'BadRequestUnsupportedDomain', 'BadRequestRequiredParamIsNull', + 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', + 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', + 'BadRequestIterationNotPublished', 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat', - 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', - 'BadRequestTrainingNotNeeded', + 'BadRequestImageSizeBytes', 'BadRequestImageDimensions', + 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', @@ -98,7 +102,11 @@ class CustomVisionError(Model): 'BadRequestPredictionTagsExceededCount', 'BadRequestPredictionResultsExceededCount', 'BadRequestPredictionInvalidApplicationName', - 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', + 'BadRequestPredictionInvalidQueryParameters', + 'BadRequestInvalidImportToken', 'BadRequestExportWhileTraining', + 'BadRequestImageMetadataKey', 'BadRequestImageMetadataValue', + 'BadRequestOperationNotSupported', 'BadRequestInvalidArtifactUri', + 'BadRequestCustomerManagedKeyRevoked', 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', @@ -107,19 +115,20 @@ class CustomVisionError(Model): 'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid', - 'Conflict', 'ConflictInvalid', 'ErrorUnknown', - 'ErrorProjectInvalidWorkspace', + 'Conflict', 'ConflictInvalid', 'ErrorUnknown', 'ErrorIterationCopyFailed', + 'ErrorPreparePerformanceMigrationFailed', 'ErrorProjectInvalidWorkspace', 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', - 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', - 'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout', - 'ErrorFeaturizationInvalidFeaturizer', + 'ErrorProjectTrainingRequestFailed', 'ErrorProjectImportRequestFailed', + 'ErrorProjectExportRequestFailed', 'ErrorFeaturizationServiceUnavailable', + 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', 'ErrorFeaturizationAugmentationUnavailable', 'ErrorFeaturizationUnrecognizedJob', 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', - 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorUnknownBaseModel', + 'ErrorInvalid' :type code: str or ~azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorCodes :param message: Required. A message explaining the error reported by the @@ -236,6 +245,10 @@ class Prediction(Model): :ivar bounding_box: Bounding box of the prediction. :vartype bounding_box: ~azure.cognitiveservices.vision.customvision.prediction.models.BoundingBox + :ivar tag_type: Type of the predicted tag. Possible values include: + 'Regular', 'Negative', 'GeneralProduct' + :vartype tag_type: str or + ~azure.cognitiveservices.vision.customvision.prediction.models.TagType """ _validation = { @@ -243,6 +256,7 @@ class Prediction(Model): 'tag_id': {'readonly': True}, 'tag_name': {'readonly': True}, 'bounding_box': {'readonly': True}, + 'tag_type': {'readonly': True}, } _attribute_map = { @@ -250,6 +264,7 @@ class Prediction(Model): 'tag_id': {'key': 'tagId', 'type': 'str'}, 'tag_name': {'key': 'tagName', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'}, + 'tag_type': {'key': 'tagType', 'type': 'str'}, } def __init__(self, **kwargs) -> None: @@ -258,3 +273,4 @@ def __init__(self, **kwargs) -> None: self.tag_id = None self.tag_name = None self.bounding_box = None + self.tag_type = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py index 49127e2fb22c..9ee845e0360a 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py @@ -15,17 +15,18 @@ class CustomVisionPredictionClientOperationsMixin(object): - def classify_image_url( - self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image url and saves the result. + def classify_image( + self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): + """Classify an image and saves the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param url: Url of the image. - :type url: str + :param image_data: Binary image data. Supported formats are JPEG, GIF, + PNG, and BMP. Supports images up to 4MB. + :type image_data: Generator :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -41,10 +42,8 @@ def classify_image_url( :raises: :class:`CustomVisionErrorException` """ - image_url = models.ImageUrl(url=url) - # Construct URL - url = self.classify_image_url.metadata['url'] + url = self.classify_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -60,15 +59,17 @@ def classify_image_url( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Content-Type'] = 'multipart/form-data' if custom_headers: header_parameters.update(custom_headers) - # Construct body - body_content = self._serialize.body(image_url, 'ImageUrl') + # Construct form data + form_data_content = { + 'imageData': image_data, + } # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -83,11 +84,11 @@ def classify_image_url( return client_raw_response return deserialized - classify_image_url.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url'} + classify_image.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image'} - def classify_image( + def classify_image_with_no_store( self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image and saves the result. + """Classify an image without saving the result. :param project_id: The project id. :type project_id: str @@ -113,7 +114,7 @@ def classify_image( :class:`CustomVisionErrorException` """ # Construct URL - url = self.classify_image.metadata['url'] + url = self.classify_image_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -154,11 +155,11 @@ def classify_image( return client_raw_response return deserialized - classify_image.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image'} + classify_image_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image/nostore'} - def classify_image_url_with_no_store( + def classify_image_url( self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image url without saving the result. + """Classify an image url and saves the result. :param project_id: The project id. :type project_id: str @@ -185,7 +186,7 @@ def classify_image_url_with_no_store( image_url = models.ImageUrl(url=url) # Construct URL - url = self.classify_image_url_with_no_store.metadata['url'] + url = self.classify_image_url.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -224,20 +225,19 @@ def classify_image_url_with_no_store( return client_raw_response return deserialized - classify_image_url_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url/nostore'} + classify_image_url.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url'} - def classify_image_with_no_store( - self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image without saving the result. + def classify_image_url_with_no_store( + self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): + """Classify an image url without saving the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param image_data: Binary image data. Supported formats are JPEG, GIF, - PNG, and BMP. Supports images up to 0MB. - :type image_data: Generator + :param url: Url of the image. + :type url: str :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -253,8 +253,10 @@ def classify_image_with_no_store( :raises: :class:`CustomVisionErrorException` """ + image_url = models.ImageUrl(url=url) + # Construct URL - url = self.classify_image_with_no_store.metadata['url'] + url = self.classify_image_url_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -270,17 +272,15 @@ def classify_image_with_no_store( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'multipart/form-data' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) - # Construct form data - form_data_content = { - 'imageData': image_data, - } + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -295,19 +295,20 @@ def classify_image_with_no_store( return client_raw_response return deserialized - classify_image_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image/nostore'} + classify_image_url_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url/nostore'} - def detect_image_url( - self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image url and saves the result. + def detect_image( + self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): + """Detect objects in an image and saves the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param url: Url of the image. - :type url: str + :param image_data: Binary image data. Supported formats are JPEG, GIF, + PNG, and BMP. Supports images up to 4MB. + :type image_data: Generator :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -323,10 +324,8 @@ def detect_image_url( :raises: :class:`CustomVisionErrorException` """ - image_url = models.ImageUrl(url=url) - # Construct URL - url = self.detect_image_url.metadata['url'] + url = self.detect_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -342,15 +341,17 @@ def detect_image_url( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Content-Type'] = 'multipart/form-data' if custom_headers: header_parameters.update(custom_headers) - # Construct body - body_content = self._serialize.body(image_url, 'ImageUrl') + # Construct form data + form_data_content = { + 'imageData': image_data, + } # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -365,11 +366,11 @@ def detect_image_url( return client_raw_response return deserialized - detect_image_url.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url'} + detect_image.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image'} - def detect_image( + def detect_image_with_no_store( self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image and saves the result. + """Detect objects in an image without saving the result. :param project_id: The project id. :type project_id: str @@ -395,7 +396,7 @@ def detect_image( :class:`CustomVisionErrorException` """ # Construct URL - url = self.detect_image.metadata['url'] + url = self.detect_image_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -436,11 +437,11 @@ def detect_image( return client_raw_response return deserialized - detect_image.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image'} + detect_image_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image/nostore'} - def detect_image_url_with_no_store( + def detect_image_url( self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image url without saving the result. + """Detect objects in an image url and saves the result. :param project_id: The project id. :type project_id: str @@ -467,7 +468,7 @@ def detect_image_url_with_no_store( image_url = models.ImageUrl(url=url) # Construct URL - url = self.detect_image_url_with_no_store.metadata['url'] + url = self.detect_image_url.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -506,20 +507,19 @@ def detect_image_url_with_no_store( return client_raw_response return deserialized - detect_image_url_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url/nostore'} + detect_image_url.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url'} - def detect_image_with_no_store( - self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image without saving the result. + def detect_image_url_with_no_store( + self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): + """Detect objects in an image url without saving the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param image_data: Binary image data. Supported formats are JPEG, GIF, - PNG, and BMP. Supports images up to 0MB. - :type image_data: Generator + :param url: Url of the image. + :type url: str :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -535,8 +535,10 @@ def detect_image_with_no_store( :raises: :class:`CustomVisionErrorException` """ + image_url = models.ImageUrl(url=url) + # Construct URL - url = self.detect_image_with_no_store.metadata['url'] + url = self.detect_image_url_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -552,17 +554,15 @@ def detect_image_with_no_store( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'multipart/form-data' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) - # Construct form data - form_data_content = { - 'imageData': image_data, - } + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -577,4 +577,4 @@ def detect_image_with_no_store( return client_raw_response return deserialized - detect_image_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image/nostore'} + detect_image_url_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url/nostore'}