diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md index 45c9901dbbd4..830deb5428e4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 0.6.0 (2020-05-18) + +**Features** + + - Model Line has a new parameter language + - Added operation ComputerVisionClientOperationsMixin.read + - Added operation ComputerVisionClientOperationsMixin.get_read_result + - Added operation ComputerVisionClientOperationsMixin.read_in_stream + +**Breaking changes** + + - Parameter words of model Line is now required + - Parameter bounding_box of model Line is now required + - Parameter text of model Line is now required + - Parameter confidence of model Word is now required + - Removed operation ComputerVisionClientOperationsMixin.get_text_operation_result + - Removed operation ComputerVisionClientOperationsMixin.get_read_operation_result + - Removed operation ComputerVisionClientOperationsMixin.recognize_text_in_stream + - Removed operation ComputerVisionClientOperationsMixin.recognize_text + - Removed operation ComputerVisionClientOperationsMixin.batch_read_file + - Removed operation ComputerVisionClientOperationsMixin.batch_read_file_in_stream + - Model ReadOperationResult has a new signature + ## 0.5.0 (2019-10-01) **Features** diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/README.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/README.md index 0956f6eb55b0..8d793d5cf878 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/README.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/README.md @@ -183,21 +183,18 @@ for caption in analysis.captions: ### Get text from image -You can get any handwritten or printed text from an image. This requires two calls to the SDK: [`recognize_text`][ref_computervisionclient_recognize_text] and [`get_text_operation_result`][ref_computervisionclient_get_text_operation_result]. The call to recognize_text is asynchronous. In the results of the get_text_operation_result call, you need to check if the first call completed with [`TextOperationStatusCodes`][ref_computervision_model_textoperationstatuscodes] before extracting the text data. The results include the text as well as the bounding box coordinates for the text. +You can get any handwritten or printed text from an image. This requires two calls to the SDK: [`read`][ref_computervisionclient_read] and [`get_read_result`][ref_computervisionclient_get_read_result]. The call to read is asynchronous. In the results of the get_read_result call, you need to check if the first call completed with [`OperationStatusCodes`][ref_computervision_model_operationstatuscodes] before extracting the text data. The results include the text as well as the bounding box coordinates for the text. ```Python # import models -from azure.cognitiveservices.vision.computervision.models import TextRecognitionMode -from azure.cognitiveservices.vision.computervision.models import TextOperationStatusCodes +from azure.cognitiveservices.vision.computervision.models import OperationStatusCodes url = "https://github.com/Azure-Samples/cognitive-services-python-sdk-samples/raw/master/samples/vision/images/make_things_happen.jpg" -mode = TextRecognitionMode.printed raw = True -custom_headers = None numberOfCharsInOperationId = 36 # SDK call -rawHttpResponse = client.recognize_text(url, mode, custom_headers, raw) +rawHttpResponse = client.read(url, language="en", raw=True) # Get ID from returned headers operationLocation = rawHttpResponse.headers["Operation-Location"] @@ -205,12 +202,12 @@ idLocation = len(operationLocation) - numberOfCharsInOperationId operationId = operationLocation[idLocation:] # SDK call -result = client.get_text_operation_result(operationId) +result = client.get_read_result(operationId) # Get data -if result.status == TextOperationStatusCodes.succeeded: +if result.status == OperationStatusCodes.succeeded: - for line in result.recognition_result.lines: + for line in result.analyze_result.read_results[0].lines: print(line.text) print(line.bounding_box) ``` @@ -275,7 +272,7 @@ While working with the [ComputerVisionClient][ref_computervisionclient] client, Several Computer Vision Python SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Computer Vision: -* [recognize_text][recognize-text] +* [See sample repo][recognize-text] ### Additional documentation @@ -317,14 +314,14 @@ For more extensive documentation on the Computer Vision service, see the [Azure [ref_computervisionclient_list_models]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#list-models-custom-headers-none--raw-false----operation-config- [ref_computervisionclient_analyze_image_by_domain]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#analyze-image-by-domain-model--url--language--en---custom-headers-none--raw-false----operation-config- [ref_computervisionclient_describe_image]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#describe-image-url--max-candidates--1---language--en---custom-headers-none--raw-false----operation-config- -[ref_computervisionclient_recognize_text]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#recognize-text-url--mode--custom-headers-none--raw-false----operation-config- -[ref_computervisionclient_get_text_operation_result]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#get-text-operation-result-operation-id--custom-headers-none--raw-false----operation-config- +[ref_computervisionclient_read]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#read-url--mode--custom-headers-none--raw-false----operation-config- +[ref_computervisionclient_get_read_result]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#get-read-result-operation-id--custom-headers-none--raw-false----operation-config- [ref_computervisionclient_generate_thumbnail]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.computervisionclient?view=azure-python#generate-thumbnail-width--height--url--smart-cropping-false--custom-headers-none--raw-false--callback-none----operation-config- [ref_computervision_model_visualfeatures]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.models.visualfeaturetypes?view=azure-python -[ref_computervision_model_textoperationstatuscodes]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.models.textoperationstatuscodes?view=azure-python +[ref_computervision_model_operationstatuscodes]:https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-computervision/azure.cognitiveservices.vision.computervision.models.operationstatuscodes?view=azure-python [computervision_request_units]:https://azure.microsoft.com/pricing/details/cognitive-services/computer-vision/ diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_computer_vision_client.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_computer_vision_client.py index 66db7e8147cd..e2d380c69638 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_computer_vision_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_computer_vision_client.py @@ -38,7 +38,7 @@ def __init__( super(ComputerVisionClient, 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 = '2.1' + self.api_version = '3.0' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_configuration.py index 4231ac56a0a4..7a5c5c553bc9 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_configuration.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/_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}/vision/v2.1' + base_url = '{Endpoint}/vision/v3.0' super(ComputerVisionClientConfiguration, self).__init__(base_url) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py index 98057e314d77..5633061bc93b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py @@ -11,6 +11,7 @@ try: from ._models_py3 import AdultInfo + from ._models_py3 import AnalyzeResults from ._models_py3 import AreaOfInterestResult from ._models_py3 import BoundingRect from ._models_py3 import Category @@ -44,12 +45,12 @@ from ._models_py3 import OcrResult from ._models_py3 import OcrWord from ._models_py3 import ReadOperationResult + from ._models_py3 import ReadResult from ._models_py3 import TagResult - from ._models_py3 import TextOperationResult - from ._models_py3 import TextRecognitionResult from ._models_py3 import Word except (SyntaxError, ImportError): from ._models import AdultInfo + from ._models import AnalyzeResults from ._models import AreaOfInterestResult from ._models import BoundingRect from ._models import Category @@ -83,24 +84,23 @@ from ._models import OcrResult from ._models import OcrWord from ._models import ReadOperationResult + from ._models import ReadResult from ._models import TagResult - from ._models import TextOperationResult - from ._models import TextRecognitionResult from ._models import Word from ._computer_vision_client_enums import ( DescriptionExclude, Details, Gender, + OcrDetectionLanguage, OcrLanguages, - TextOperationStatusCodes, - TextRecognitionMode, - TextRecognitionResultConfidenceClass, + OperationStatusCodes, TextRecognitionResultDimensionUnit, VisualFeatureTypes, ) __all__ = [ 'AdultInfo', + 'AnalyzeResults', 'AreaOfInterestResult', 'BoundingRect', 'Category', @@ -134,17 +134,15 @@ 'OcrResult', 'OcrWord', 'ReadOperationResult', + 'ReadResult', 'TagResult', - 'TextOperationResult', - 'TextRecognitionResult', 'Word', 'Gender', - 'TextOperationStatusCodes', + 'OperationStatusCodes', 'TextRecognitionResultDimensionUnit', - 'TextRecognitionResultConfidenceClass', 'DescriptionExclude', 'OcrLanguages', 'VisualFeatureTypes', - 'TextRecognitionMode', + 'OcrDetectionLanguage', 'Details', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_computer_vision_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_computer_vision_client_enums.py index 2c319134cff0..d8cb9260286e 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_computer_vision_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_computer_vision_client_enums.py @@ -18,12 +18,12 @@ class Gender(str, Enum): female = "Female" -class TextOperationStatusCodes(str, Enum): +class OperationStatusCodes(str, Enum): - not_started = "NotStarted" - running = "Running" - failed = "Failed" - succeeded = "Succeeded" + not_started = "notStarted" + running = "running" + failed = "failed" + succeeded = "succeeded" class TextRecognitionResultDimensionUnit(str, Enum): @@ -32,12 +32,6 @@ class TextRecognitionResultDimensionUnit(str, Enum): inch = "inch" -class TextRecognitionResultConfidenceClass(str, Enum): - - high = "High" - low = "Low" - - class DescriptionExclude(str, Enum): celebrities = "Celebrities" @@ -88,10 +82,15 @@ class VisualFeatureTypes(str, Enum): brands = "Brands" -class TextRecognitionMode(str, Enum): +class OcrDetectionLanguage(str, Enum): - handwritten = "Handwritten" - printed = "Printed" + en = "en" + es = "es" + fr = "fr" + de = "de" + it = "it" + nl = "nl" + pt = "pt" class Details(str, Enum): diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models.py index 1954cb533892..f0ef37445759 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models.py @@ -53,6 +53,34 @@ def __init__(self, **kwargs): self.gore_score = kwargs.get('gore_score', None) +class AnalyzeResults(Model): + """Analyze batch operation result. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. Version of schema used for this result. + :type version: str + :param read_results: Required. Text extracted from the input. + :type read_results: + list[~azure.cognitiveservices.vision.computervision.models.ReadResult] + """ + + _validation = { + 'version': {'required': True}, + 'read_results': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'read_results': {'key': 'readResults', 'type': '[ReadResult]'}, + } + + def __init__(self, **kwargs): + super(AnalyzeResults, self).__init__(**kwargs) + self.version = kwargs.get('version', None) + self.read_results = kwargs.get('read_results', None) + + class AreaOfInterestResult(Model): """Result of AreaOfInterest operation. @@ -767,16 +795,28 @@ def __init__(self, **kwargs): class Line(Model): """An object representing a recognized text line. - :param bounding_box: Bounding box of a recognized line. + All required parameters must be populated in order to send to Azure. + + :param language: The BCP-47 language code of the recognized text line. + Only provided where the language of the line differs from the page's. + :type language: str + :param bounding_box: Required. Bounding box of a recognized line. :type bounding_box: list[float] - :param text: The text content of the line. + :param text: Required. The text content of the line. :type text: str - :param words: List of words in the text line. + :param words: Required. List of words in the text line. :type words: list[~azure.cognitiveservices.vision.computervision.models.Word] """ + _validation = { + 'bounding_box': {'required': True}, + 'text': {'required': True}, + 'words': {'required': True}, + } + _attribute_map = { + 'language': {'key': 'language', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, 'text': {'key': 'text', 'type': 'str'}, 'words': {'key': 'words', 'type': '[Word]'}, @@ -784,6 +824,7 @@ class Line(Model): def __init__(self, **kwargs): super(Line, self).__init__(**kwargs) + self.language = kwargs.get('language', None) self.bounding_box = kwargs.get('bounding_box', None) self.text = kwargs.get('text', None) self.words = kwargs.get('words', None) @@ -989,93 +1030,56 @@ class ReadOperationResult(Model): """OCR result of the read operation. :param status: Status of the read operation. Possible values include: - 'NotStarted', 'Running', 'Failed', 'Succeeded' + 'notStarted', 'running', 'failed', 'succeeded' :type status: str or - ~azure.cognitiveservices.vision.computervision.models.TextOperationStatusCodes - :param recognition_results: An array of text recognition result of the - read operation. - :type recognition_results: - list[~azure.cognitiveservices.vision.computervision.models.TextRecognitionResult] + ~azure.cognitiveservices.vision.computervision.models.OperationStatusCodes + :param created_date_time: Get UTC date time the batch operation was + submitted. + :type created_date_time: str + :param last_updated_date_time: Get last updated UTC date time of this + batch operation. + :type last_updated_date_time: str + :param analyze_result: Analyze batch operation result. + :type analyze_result: + ~azure.cognitiveservices.vision.computervision.models.AnalyzeResults """ _attribute_map = { - 'status': {'key': 'status', 'type': 'TextOperationStatusCodes'}, - 'recognition_results': {'key': 'recognitionResults', 'type': '[TextRecognitionResult]'}, + 'status': {'key': 'status', 'type': 'OperationStatusCodes'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'str'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'str'}, + 'analyze_result': {'key': 'analyzeResult', 'type': 'AnalyzeResults'}, } def __init__(self, **kwargs): super(ReadOperationResult, self).__init__(**kwargs) self.status = kwargs.get('status', None) - self.recognition_results = kwargs.get('recognition_results', None) - - -class TagResult(Model): - """The results of a image tag operation, including any tags and image - metadata. - - :param tags: A list of tags with confidence level. - :type tags: - list[~azure.cognitiveservices.vision.computervision.models.ImageTag] - :param request_id: Id of the REST API request. - :type request_id: str - :param metadata: - :type metadata: - ~azure.cognitiveservices.vision.computervision.models.ImageMetadata - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '[ImageTag]'}, - 'request_id': {'key': 'requestId', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, - } - - def __init__(self, **kwargs): - super(TagResult, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.request_id = kwargs.get('request_id', None) - self.metadata = kwargs.get('metadata', None) - - -class TextOperationResult(Model): - """Result of recognition text operation. - - :param status: Status of the text operation. Possible values include: - 'NotStarted', 'Running', 'Failed', 'Succeeded' - :type status: str or - ~azure.cognitiveservices.vision.computervision.models.TextOperationStatusCodes - :param recognition_result: Text recognition result of the text operation. - :type recognition_result: - ~azure.cognitiveservices.vision.computervision.models.TextRecognitionResult - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'TextOperationStatusCodes'}, - 'recognition_result': {'key': 'recognitionResult', 'type': 'TextRecognitionResult'}, - } - - def __init__(self, **kwargs): - super(TextOperationResult, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.recognition_result = kwargs.get('recognition_result', None) + self.created_date_time = kwargs.get('created_date_time', None) + self.last_updated_date_time = kwargs.get('last_updated_date_time', None) + self.analyze_result = kwargs.get('analyze_result', None) -class TextRecognitionResult(Model): - """An object representing a recognized text region. +class ReadResult(Model): + """Text extracted from a page in the input document. All required parameters must be populated in order to send to Azure. - :param page: The 1-based page number of the recognition result. + :param page: Required. The 1-based page number of the recognition result. :type page: int - :param clockwise_orientation: The orientation of the image in degrees in - the clockwise direction. Range between [0, 360). - :type clockwise_orientation: float - :param width: The width of the image in pixels or the PDF in inches. + :param language: The BCP-47 language code of the recognized text page. + :type language: str + :param angle: Required. The orientation of the image in degrees in the + clockwise direction. Range between [-180, 180). + :type angle: float + :param width: Required. The width of the image in pixels or the PDF in + inches. :type width: float - :param height: The height of the image in pixels or the PDF in inches. + :param height: Required. The height of the image in pixels or the PDF in + inches. :type height: float - :param unit: The unit used in the Width, Height and BoundingBox. For - images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible values - include: 'pixel', 'inch' + :param unit: Required. The unit used in the Width, Height and BoundingBox. + For images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible + values include: 'pixel', 'inch' :type unit: str or ~azure.cognitiveservices.vision.computervision.models.TextRecognitionResultDimensionUnit :param lines: Required. A list of recognized text lines. @@ -1084,12 +1088,18 @@ class TextRecognitionResult(Model): """ _validation = { + 'page': {'required': True}, + 'angle': {'required': True}, + 'width': {'required': True}, + 'height': {'required': True}, + 'unit': {'required': True}, 'lines': {'required': True}, } _attribute_map = { 'page': {'key': 'page', 'type': 'int'}, - 'clockwise_orientation': {'key': 'clockwiseOrientation', 'type': 'float'}, + 'language': {'key': 'language', 'type': 'str'}, + 'angle': {'key': 'angle', 'type': 'float'}, 'width': {'key': 'width', 'type': 'float'}, 'height': {'key': 'height', 'type': 'float'}, 'unit': {'key': 'unit', 'type': 'TextRecognitionResultDimensionUnit'}, @@ -1097,15 +1107,43 @@ class TextRecognitionResult(Model): } def __init__(self, **kwargs): - super(TextRecognitionResult, self).__init__(**kwargs) + super(ReadResult, self).__init__(**kwargs) self.page = kwargs.get('page', None) - self.clockwise_orientation = kwargs.get('clockwise_orientation', None) + self.language = kwargs.get('language', None) + self.angle = kwargs.get('angle', None) self.width = kwargs.get('width', None) self.height = kwargs.get('height', None) self.unit = kwargs.get('unit', None) self.lines = kwargs.get('lines', None) +class TagResult(Model): + """The results of a image tag operation, including any tags and image + metadata. + + :param tags: A list of tags with confidence level. + :type tags: + list[~azure.cognitiveservices.vision.computervision.models.ImageTag] + :param request_id: Id of the REST API request. + :type request_id: str + :param metadata: + :type metadata: + ~azure.cognitiveservices.vision.computervision.models.ImageMetadata + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '[ImageTag]'}, + 'request_id': {'key': 'requestId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, + } + + def __init__(self, **kwargs): + super(TagResult, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.request_id = kwargs.get('request_id', None) + self.metadata = kwargs.get('metadata', None) + + class Word(Model): """An object representing a recognized word. @@ -1115,21 +1153,20 @@ class Word(Model): :type bounding_box: list[float] :param text: Required. The text content of the word. :type text: str - :param confidence: Qualitative confidence measure. Possible values - include: 'High', 'Low' - :type confidence: str or - ~azure.cognitiveservices.vision.computervision.models.TextRecognitionResultConfidenceClass + :param confidence: Required. Qualitative confidence measure. + :type confidence: float """ _validation = { 'bounding_box': {'required': True}, 'text': {'required': True}, + 'confidence': {'required': True}, } _attribute_map = { 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, 'text': {'key': 'text', 'type': 'str'}, - 'confidence': {'key': 'confidence', 'type': 'TextRecognitionResultConfidenceClass'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, } def __init__(self, **kwargs): diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models_py3.py index 0df15fb9e295..09951eeef9a3 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/_models_py3.py @@ -53,6 +53,34 @@ def __init__(self, *, is_adult_content: bool=None, is_racy_content: bool=None, i self.gore_score = gore_score +class AnalyzeResults(Model): + """Analyze batch operation result. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. Version of schema used for this result. + :type version: str + :param read_results: Required. Text extracted from the input. + :type read_results: + list[~azure.cognitiveservices.vision.computervision.models.ReadResult] + """ + + _validation = { + 'version': {'required': True}, + 'read_results': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'read_results': {'key': 'readResults', 'type': '[ReadResult]'}, + } + + def __init__(self, *, version: str, read_results, **kwargs) -> None: + super(AnalyzeResults, self).__init__(**kwargs) + self.version = version + self.read_results = read_results + + class AreaOfInterestResult(Model): """Result of AreaOfInterest operation. @@ -767,23 +795,36 @@ def __init__(self, *, name: str=None, confidence: float=None, **kwargs) -> None: class Line(Model): """An object representing a recognized text line. - :param bounding_box: Bounding box of a recognized line. + All required parameters must be populated in order to send to Azure. + + :param language: The BCP-47 language code of the recognized text line. + Only provided where the language of the line differs from the page's. + :type language: str + :param bounding_box: Required. Bounding box of a recognized line. :type bounding_box: list[float] - :param text: The text content of the line. + :param text: Required. The text content of the line. :type text: str - :param words: List of words in the text line. + :param words: Required. List of words in the text line. :type words: list[~azure.cognitiveservices.vision.computervision.models.Word] """ + _validation = { + 'bounding_box': {'required': True}, + 'text': {'required': True}, + 'words': {'required': True}, + } + _attribute_map = { + 'language': {'key': 'language', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, 'text': {'key': 'text', 'type': 'str'}, 'words': {'key': 'words', 'type': '[Word]'}, } - def __init__(self, *, bounding_box=None, text: str=None, words=None, **kwargs) -> None: + def __init__(self, *, bounding_box, text: str, words, language: str=None, **kwargs) -> None: super(Line, self).__init__(**kwargs) + self.language = language self.bounding_box = bounding_box self.text = text self.words = words @@ -989,93 +1030,56 @@ class ReadOperationResult(Model): """OCR result of the read operation. :param status: Status of the read operation. Possible values include: - 'NotStarted', 'Running', 'Failed', 'Succeeded' + 'notStarted', 'running', 'failed', 'succeeded' :type status: str or - ~azure.cognitiveservices.vision.computervision.models.TextOperationStatusCodes - :param recognition_results: An array of text recognition result of the - read operation. - :type recognition_results: - list[~azure.cognitiveservices.vision.computervision.models.TextRecognitionResult] + ~azure.cognitiveservices.vision.computervision.models.OperationStatusCodes + :param created_date_time: Get UTC date time the batch operation was + submitted. + :type created_date_time: str + :param last_updated_date_time: Get last updated UTC date time of this + batch operation. + :type last_updated_date_time: str + :param analyze_result: Analyze batch operation result. + :type analyze_result: + ~azure.cognitiveservices.vision.computervision.models.AnalyzeResults """ _attribute_map = { - 'status': {'key': 'status', 'type': 'TextOperationStatusCodes'}, - 'recognition_results': {'key': 'recognitionResults', 'type': '[TextRecognitionResult]'}, + 'status': {'key': 'status', 'type': 'OperationStatusCodes'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'str'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'str'}, + 'analyze_result': {'key': 'analyzeResult', 'type': 'AnalyzeResults'}, } - def __init__(self, *, status=None, recognition_results=None, **kwargs) -> None: + def __init__(self, *, status=None, created_date_time: str=None, last_updated_date_time: str=None, analyze_result=None, **kwargs) -> None: super(ReadOperationResult, self).__init__(**kwargs) self.status = status - self.recognition_results = recognition_results - - -class TagResult(Model): - """The results of a image tag operation, including any tags and image - metadata. - - :param tags: A list of tags with confidence level. - :type tags: - list[~azure.cognitiveservices.vision.computervision.models.ImageTag] - :param request_id: Id of the REST API request. - :type request_id: str - :param metadata: - :type metadata: - ~azure.cognitiveservices.vision.computervision.models.ImageMetadata - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '[ImageTag]'}, - 'request_id': {'key': 'requestId', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, - } - - def __init__(self, *, tags=None, request_id: str=None, metadata=None, **kwargs) -> None: - super(TagResult, self).__init__(**kwargs) - self.tags = tags - self.request_id = request_id - self.metadata = metadata - - -class TextOperationResult(Model): - """Result of recognition text operation. - - :param status: Status of the text operation. Possible values include: - 'NotStarted', 'Running', 'Failed', 'Succeeded' - :type status: str or - ~azure.cognitiveservices.vision.computervision.models.TextOperationStatusCodes - :param recognition_result: Text recognition result of the text operation. - :type recognition_result: - ~azure.cognitiveservices.vision.computervision.models.TextRecognitionResult - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'TextOperationStatusCodes'}, - 'recognition_result': {'key': 'recognitionResult', 'type': 'TextRecognitionResult'}, - } - - def __init__(self, *, status=None, recognition_result=None, **kwargs) -> None: - super(TextOperationResult, self).__init__(**kwargs) - self.status = status - self.recognition_result = recognition_result + self.created_date_time = created_date_time + self.last_updated_date_time = last_updated_date_time + self.analyze_result = analyze_result -class TextRecognitionResult(Model): - """An object representing a recognized text region. +class ReadResult(Model): + """Text extracted from a page in the input document. All required parameters must be populated in order to send to Azure. - :param page: The 1-based page number of the recognition result. + :param page: Required. The 1-based page number of the recognition result. :type page: int - :param clockwise_orientation: The orientation of the image in degrees in - the clockwise direction. Range between [0, 360). - :type clockwise_orientation: float - :param width: The width of the image in pixels or the PDF in inches. + :param language: The BCP-47 language code of the recognized text page. + :type language: str + :param angle: Required. The orientation of the image in degrees in the + clockwise direction. Range between [-180, 180). + :type angle: float + :param width: Required. The width of the image in pixels or the PDF in + inches. :type width: float - :param height: The height of the image in pixels or the PDF in inches. + :param height: Required. The height of the image in pixels or the PDF in + inches. :type height: float - :param unit: The unit used in the Width, Height and BoundingBox. For - images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible values - include: 'pixel', 'inch' + :param unit: Required. The unit used in the Width, Height and BoundingBox. + For images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible + values include: 'pixel', 'inch' :type unit: str or ~azure.cognitiveservices.vision.computervision.models.TextRecognitionResultDimensionUnit :param lines: Required. A list of recognized text lines. @@ -1084,28 +1088,62 @@ class TextRecognitionResult(Model): """ _validation = { + 'page': {'required': True}, + 'angle': {'required': True}, + 'width': {'required': True}, + 'height': {'required': True}, + 'unit': {'required': True}, 'lines': {'required': True}, } _attribute_map = { 'page': {'key': 'page', 'type': 'int'}, - 'clockwise_orientation': {'key': 'clockwiseOrientation', 'type': 'float'}, + 'language': {'key': 'language', 'type': 'str'}, + 'angle': {'key': 'angle', 'type': 'float'}, 'width': {'key': 'width', 'type': 'float'}, 'height': {'key': 'height', 'type': 'float'}, 'unit': {'key': 'unit', 'type': 'TextRecognitionResultDimensionUnit'}, 'lines': {'key': 'lines', 'type': '[Line]'}, } - def __init__(self, *, lines, page: int=None, clockwise_orientation: float=None, width: float=None, height: float=None, unit=None, **kwargs) -> None: - super(TextRecognitionResult, self).__init__(**kwargs) + def __init__(self, *, page: int, angle: float, width: float, height: float, unit, lines, language: str=None, **kwargs) -> None: + super(ReadResult, self).__init__(**kwargs) self.page = page - self.clockwise_orientation = clockwise_orientation + self.language = language + self.angle = angle self.width = width self.height = height self.unit = unit self.lines = lines +class TagResult(Model): + """The results of a image tag operation, including any tags and image + metadata. + + :param tags: A list of tags with confidence level. + :type tags: + list[~azure.cognitiveservices.vision.computervision.models.ImageTag] + :param request_id: Id of the REST API request. + :type request_id: str + :param metadata: + :type metadata: + ~azure.cognitiveservices.vision.computervision.models.ImageMetadata + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '[ImageTag]'}, + 'request_id': {'key': 'requestId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, + } + + def __init__(self, *, tags=None, request_id: str=None, metadata=None, **kwargs) -> None: + super(TagResult, self).__init__(**kwargs) + self.tags = tags + self.request_id = request_id + self.metadata = metadata + + class Word(Model): """An object representing a recognized word. @@ -1115,24 +1153,23 @@ class Word(Model): :type bounding_box: list[float] :param text: Required. The text content of the word. :type text: str - :param confidence: Qualitative confidence measure. Possible values - include: 'High', 'Low' - :type confidence: str or - ~azure.cognitiveservices.vision.computervision.models.TextRecognitionResultConfidenceClass + :param confidence: Required. Qualitative confidence measure. + :type confidence: float """ _validation = { 'bounding_box': {'required': True}, 'text': {'required': True}, + 'confidence': {'required': True}, } _attribute_map = { 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, 'text': {'key': 'text', 'type': 'str'}, - 'confidence': {'key': 'confidence', 'type': 'TextRecognitionResultConfidenceClass'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, } - def __init__(self, *, bounding_box, text: str, confidence=None, **kwargs) -> None: + def __init__(self, *, bounding_box, text: str, confidence: float, **kwargs) -> None: super(Word, self).__init__(**kwargs) self.bounding_box = bounding_box self.text = text diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/operations/_computer_vision_client_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/operations/_computer_vision_client_operations.py index 3690d7aa9499..a2417588988b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/operations/_computer_vision_client_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/operations/_computer_vision_client_operations.py @@ -715,133 +715,27 @@ def get_area_of_interest( return deserialized get_area_of_interest.metadata = {'url': '/areaOfInterest'} - def recognize_text( - self, url, mode, custom_headers=None, raw=False, **operation_config): - """Recognize Text operation. When you use the Recognize Text interface, - the response contains a field called 'Operation-Location'. The - 'Operation-Location' field contains the URL that you must use for your - Get Recognize Text Operation Result operation. - - :param mode: Type of text to recognize. Possible values include: - 'Handwritten', 'Printed' - :type mode: str or - ~azure.cognitiveservices.vision.computervision.models.TextRecognitionMode - :param url: Publicly reachable URL of an image. - :type url: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ComputerVisionErrorException` - """ - image_url = models.ImageUrl(url=url) - - # Construct URL - url = self.recognize_text.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['mode'] = self._serialize.query("mode", mode, 'TextRecognitionMode') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(image_url, 'ImageUrl') - - # Construct and send request - 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 [202]: - raise models.ComputerVisionErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Operation-Location': 'str', - }) - return client_raw_response - recognize_text.metadata = {'url': '/recognizeText'} - - def get_text_operation_result( - self, operation_id, custom_headers=None, raw=False, **operation_config): - """This interface is used for getting text operation result. The URL to - this interface should be retrieved from 'Operation-Location' field - returned from Recognize Text interface. - - :param operation_id: Id of the text operation returned in the response - of the 'Recognize Text' - :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TextOperationResult or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.vision.computervision.models.TextOperationResult - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ComputerVisionErrorException` - """ - # Construct URL - url = self.get_text_operation_result.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'operationId': self._serialize.url("operation_id", operation_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ComputerVisionErrorException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TextOperationResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_text_operation_result.metadata = {'url': '/textOperations/{operationId}'} - - def batch_read_file( - self, url, custom_headers=None, raw=False, **operation_config): + def read( + self, url, language="en", custom_headers=None, raw=False, **operation_config): """Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms - optimized for text-heavy documents. When you use the Read File - interface, the response contains a field called 'Operation-Location'. - The 'Operation-Location' field contains the URL that you must use for - your 'GetReadOperationResult' operation to access OCR results.​. + optimized for text-heavy documents. When you use the Read interface, + the response contains a field called 'Operation-Location'. The + 'Operation-Location' field contains the URL that you must use for your + 'GetReadResult' operation to access OCR results.​. :param url: Publicly reachable URL of an image. :type url: str + :param language: The BCP-47 language code of the text to be detected + in the image. In future versions, when language parameter is not + passed, language detection will be used to determine the language. + However, in the current version, missing language parameter will cause + English to be used. To ensure that your document is always parsed in + English without the use of language detection in the future, pass “en” + in the language parameter. Possible values include: 'en', 'es', 'fr', + 'de', 'it', 'nl', 'pt' + :type language: str or + ~azure.cognitiveservices.vision.computervision.models.OcrDetectionLanguage :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -855,7 +749,7 @@ def batch_read_file( image_url = models.ImageUrl(url=url) # Construct URL - url = self.batch_read_file.metadata['url'] + url = self.read.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -863,6 +757,8 @@ def batch_read_file( # Construct parameters query_parameters = {} + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') # Construct headers header_parameters = {} @@ -886,16 +782,16 @@ def batch_read_file( 'Operation-Location': 'str', }) return client_raw_response - batch_read_file.metadata = {'url': '/read/core/asyncBatchAnalyze'} + read.metadata = {'url': '/read/analyze'} - def get_read_operation_result( + def get_read_result( self, operation_id, custom_headers=None, raw=False, **operation_config): """This interface is used for getting OCR results of Read operation. The URL to this interface should be retrieved from 'Operation-Location' - field returned from Batch Read File interface. + field returned from Read interface. :param operation_id: Id of read operation returned in the response of - the 'Batch Read File' interface. + the 'Read' interface. :type operation_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -910,7 +806,7 @@ def get_read_operation_result( :class:`ComputerVisionErrorException` """ # Construct URL - url = self.get_read_operation_result.metadata['url'] + url = self.get_read_result.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'operationId': self._serialize.url("operation_id", operation_id, 'str') @@ -942,7 +838,7 @@ def get_read_operation_result( return client_raw_response return deserialized - get_read_operation_result.metadata = {'url': '/read/operations/{operationId}'} + get_read_result.metadata = {'url': '/read/analyzeResults/{operationId}'} def analyze_image_in_stream( self, image, visual_features=None, details=None, language="en", description_exclude=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -1606,81 +1502,27 @@ def tag_image_in_stream( return deserialized tag_image_in_stream.metadata = {'url': '/tag'} - def recognize_text_in_stream( - self, image, mode, custom_headers=None, raw=False, callback=None, **operation_config): - """Recognize Text operation. When you use the Recognize Text interface, + def read_in_stream( + self, image, language="en", custom_headers=None, raw=False, callback=None, **operation_config): + """Use this interface to get the result of a Read operation, employing the + state-of-the-art Optical Character Recognition (OCR) algorithms + optimized for text-heavy documents. When you use the Read interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your - Get Recognize Text Operation Result operation. - - :param image: An image stream. - :type image: Generator - :param mode: Type of text to recognize. Possible values include: - 'Handwritten', 'Printed' - :type mode: str or - ~azure.cognitiveservices.vision.computervision.models.TextRecognitionMode - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ComputerVisionErrorException` - """ - # Construct URL - url = self.recognize_text_in_stream.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['mode'] = self._serialize.query("mode", mode, 'TextRecognitionMode') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/octet-stream' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._client.stream_upload(image, callback) - - # Construct and send request - 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 [202]: - raise models.ComputerVisionErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Operation-Location': 'str', - }) - return client_raw_response - recognize_text_in_stream.metadata = {'url': '/recognizeText'} - - def batch_read_file_in_stream( - self, image, custom_headers=None, raw=False, callback=None, **operation_config): - """Use this interface to get the result of a Read Document operation, - employing the state-of-the-art Optical Character Recognition (OCR) - algorithms optimized for text-heavy documents. When you use the Read - Document interface, the response contains a field called - 'Operation-Location'. The 'Operation-Location' field contains the URL - that you must use for your 'Get Read Result operation' to access OCR - results.​. + 'GetReadResult' operation to access OCR results.​. :param image: An image stream. :type image: Generator + :param language: The BCP-47 language code of the text to be detected + in the image. In future versions, when language parameter is not + passed, language detection will be used to determine the language. + However, in the current version, missing language parameter will cause + English to be used. To ensure that your document is always parsed in + English without the use of language detection in the future, pass “en” + in the language parameter. Possible values include: 'en', 'es', 'fr', + 'de', 'it', 'nl', 'pt' + :type language: str or + ~azure.cognitiveservices.vision.computervision.models.OcrDetectionLanguage :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1697,7 +1539,7 @@ def batch_read_file_in_stream( :class:`ComputerVisionErrorException` """ # Construct URL - url = self.batch_read_file_in_stream.metadata['url'] + url = self.read_in_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -1705,6 +1547,8 @@ def batch_read_file_in_stream( # Construct parameters query_parameters = {} + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') # Construct headers header_parameters = {} @@ -1728,4 +1572,4 @@ def batch_read_file_in_stream( 'Operation-Location': 'str', }) return client_raw_response - batch_read_file_in_stream.metadata = {'url': '/read/core/asyncBatchAnalyze'} + read_in_stream.metadata = {'url': '/read/analyze'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py index 266f5a486d79..5a7feab42d26 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.0" +VERSION = "0.6.0" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/sdk_packaging.toml b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/sdk_packaging.toml index 164ed3e891e0..287064235678 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/sdk_packaging.toml +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/sdk_packaging.toml @@ -5,3 +5,4 @@ package_doc_id = "cognitive-services" is_stable = false is_arm = false need_msrestazure = false +auto_update = false \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/setup.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/setup.py index e60acd4d7a62..485791c6943d 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/setup.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -67,6 +69,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False,