diff --git a/azure-cognitiveservices-vision-computervision/README.rst b/azure-cognitiveservices-vision-computervision/README.rst index eee101b4fb52..ecabe2887eb2 100644 --- a/azure-cognitiveservices-vision-computervision/README.rst +++ b/azure-cognitiveservices-vision-computervision/README.rst @@ -8,25 +8,6 @@ This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py index ffcfb39a5deb..2a0ac5f895e0 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py @@ -36,7 +36,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}' + base_url = '{Endpoint}/vision/v2.0' super(ComputerVisionClientConfiguration, self).__init__(base_url) @@ -98,7 +98,9 @@ def analyze_image( image is pornographic in nature (depicts nudity or a sex act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. - The Objects argument is only available in English. + The Objects argument is only available in English. Brands - detects + various brands within an image, including the approximate location. + The Brands argument is only available in English. :type visual_features: list[str or ~azure.cognitiveservices.vision.computervision.models.VisualFeatureTypes] :param details: A string indicating which domain-specific details to @@ -910,7 +912,9 @@ def analyze_image_in_stream( image is pornographic in nature (depicts nudity or a sex act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. - The Objects argument is only available in English. + The Objects argument is only available in English. Brands - detects + various brands within an image, including the approximate location. + The Brands argument is only available in English. :type visual_features: list[str or ~azure.cognitiveservices.vision.computervision.models.VisualFeatureTypes] :param details: A string indicating which domain-specific details to diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py index d1e90a15c852..fa9bab8f5703 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py @@ -25,6 +25,7 @@ from .bounding_rect_py3 import BoundingRect from .object_hierarchy_py3 import ObjectHierarchy from .detected_object_py3 import DetectedObject + from .detected_brand_py3 import DetectedBrand from .image_metadata_py3 import ImageMetadata from .image_analysis_py3 import ImageAnalysis from .image_description_py3 import ImageDescription @@ -62,6 +63,7 @@ from .bounding_rect import BoundingRect from .object_hierarchy import ObjectHierarchy from .detected_object import DetectedObject + from .detected_brand import DetectedBrand from .image_metadata import ImageMetadata from .image_analysis import ImageAnalysis from .image_description import ImageDescription @@ -108,6 +110,7 @@ 'BoundingRect', 'ObjectHierarchy', 'DetectedObject', + 'DetectedBrand', 'ImageMetadata', 'ImageAnalysis', 'ImageDescription', diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py index adb0ba54ef76..f72e74e483d6 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py @@ -67,6 +67,7 @@ class VisualFeatureTypes(str, Enum): tags = "Tags" description = "Description" objects = "Objects" + brands = "Brands" class TextRecognitionMode(str, Enum): diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_brand.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_brand.py new file mode 100644 index 000000000000..d4e8163045be --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_brand.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectedBrand(Model): + """A brand detected in an image. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Label for the brand. + :vartype name: str + :ivar confidence: Confidence score of having observed the brand in the + image, as a value ranging from 0 to 1. + :vartype confidence: float + :ivar rectangle: Approximate location of the detected brand. + :vartype rectangle: + ~azure.cognitiveservices.vision.computervision.models.BoundingRect + """ + + _validation = { + 'name': {'readonly': True}, + 'confidence': {'readonly': True}, + 'rectangle': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'rectangle': {'key': 'rectangle', 'type': 'BoundingRect'}, + } + + def __init__(self, **kwargs): + super(DetectedBrand, self).__init__(**kwargs) + self.name = None + self.confidence = None + self.rectangle = None diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_brand_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_brand_py3.py new file mode 100644 index 000000000000..6124c936d438 --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_brand_py3.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectedBrand(Model): + """A brand detected in an image. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Label for the brand. + :vartype name: str + :ivar confidence: Confidence score of having observed the brand in the + image, as a value ranging from 0 to 1. + :vartype confidence: float + :ivar rectangle: Approximate location of the detected brand. + :vartype rectangle: + ~azure.cognitiveservices.vision.computervision.models.BoundingRect + """ + + _validation = { + 'name': {'readonly': True}, + 'confidence': {'readonly': True}, + 'rectangle': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'rectangle': {'key': 'rectangle', 'type': 'BoundingRect'}, + } + + def __init__(self, **kwargs) -> None: + super(DetectedBrand, self).__init__(**kwargs) + self.name = None + self.confidence = None + self.rectangle = None diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py index 3a721e498848..bbaf1591579e 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py @@ -44,6 +44,9 @@ class ImageAnalysis(Model): image. :type objects: list[~azure.cognitiveservices.vision.computervision.models.DetectedObject] + :param brands: Array of brands detected in the image. + :type brands: + list[~azure.cognitiveservices.vision.computervision.models.DetectedBrand] :param request_id: Id of the REST API request. :type request_id: str :param metadata: @@ -60,6 +63,7 @@ class ImageAnalysis(Model): 'description': {'key': 'description', 'type': 'ImageDescriptionDetails'}, 'faces': {'key': 'faces', 'type': '[FaceDescription]'}, 'objects': {'key': 'objects', 'type': '[DetectedObject]'}, + 'brands': {'key': 'brands', 'type': '[DetectedBrand]'}, 'request_id': {'key': 'requestId', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, } @@ -74,5 +78,6 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) self.faces = kwargs.get('faces', None) self.objects = kwargs.get('objects', None) + self.brands = kwargs.get('brands', None) self.request_id = kwargs.get('request_id', None) self.metadata = kwargs.get('metadata', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py index 55d392077613..fa56a3362a03 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py @@ -44,6 +44,9 @@ class ImageAnalysis(Model): image. :type objects: list[~azure.cognitiveservices.vision.computervision.models.DetectedObject] + :param brands: Array of brands detected in the image. + :type brands: + list[~azure.cognitiveservices.vision.computervision.models.DetectedBrand] :param request_id: Id of the REST API request. :type request_id: str :param metadata: @@ -60,11 +63,12 @@ class ImageAnalysis(Model): 'description': {'key': 'description', 'type': 'ImageDescriptionDetails'}, 'faces': {'key': 'faces', 'type': '[FaceDescription]'}, 'objects': {'key': 'objects', 'type': '[DetectedObject]'}, + 'brands': {'key': 'brands', 'type': '[DetectedBrand]'}, 'request_id': {'key': 'requestId', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, } - def __init__(self, *, categories=None, adult=None, color=None, image_type=None, tags=None, description=None, faces=None, objects=None, request_id: str=None, metadata=None, **kwargs) -> None: + def __init__(self, *, categories=None, adult=None, color=None, image_type=None, tags=None, description=None, faces=None, objects=None, brands=None, request_id: str=None, metadata=None, **kwargs) -> None: super(ImageAnalysis, self).__init__(**kwargs) self.categories = categories self.adult = adult @@ -74,5 +78,6 @@ def __init__(self, *, categories=None, adult=None, color=None, image_type=None, self.description = description self.faces = faces self.objects = objects + self.brands = brands self.request_id = request_id self.metadata = metadata diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py index 3e682bbd5fb1..63f83465c874 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.3.0" +VERSION = "2.0"