Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/data-plane/ComputerVision] ComputerVision: bug fixes for /describe and /analyze [breaking] #2990

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def recognize_printed_text(
recognize_printed_text.metadata = {'url': '/ocr'}

def describe_image(
self, url, max_candidates="1", language="en", custom_headers=None, raw=False, **operation_config):
self, url, max_candidates=1, language="en", custom_headers=None, raw=False, **operation_config):
"""This operation generates a description of an image in human readable
language with complete sentences. The description is based on a
collection of content tags, which are also returned by the operation.
Expand All @@ -399,7 +399,7 @@ def describe_image(
:type url: str
:param max_candidates: Maximum number of candidate descriptions to be
returned. The default is 1.
:type max_candidates: str
:type max_candidates: int
:param language: The desired language for output generation. If this
parameter is not specified, the default value is
"en".Supported languages:en - English, Default. es -
Expand Down Expand Up @@ -430,7 +430,7 @@ def describe_image(
# Construct parameters
query_parameters = {}
if max_candidates is not None:
query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'str')
query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'int')
if language is not None:
query_parameters['language'] = self._serialize.query("language", language, 'str')

Expand Down Expand Up @@ -756,8 +756,9 @@ def analyze_image_in_stream(
:param details: A string indicating which domain-specific details to
return. Multiple values should be comma-separated. Valid visual
feature types include:Celebrities - identifies celebrities if detected
in the image. Possible values include: 'Celebrities', 'Landmarks'
:type details: str
in the image.
:type details: list[str or
~azure.cognitiveservices.vision.computervision.models.Details]
:param language: The desired language for output generation. If this
parameter is not specified, the default value is
"en".Supported languages:en - English, Default. es -
Expand Down Expand Up @@ -793,7 +794,7 @@ def analyze_image_in_stream(
if visual_features is not None:
query_parameters['visualFeatures'] = self._serialize.query("visual_features", visual_features, '[VisualFeatureTypes]', div=',')
if details is not None:
query_parameters['details'] = self._serialize.query("details", details, 'str')
query_parameters['details'] = self._serialize.query("details", details, '[Details]', div=',')
if language is not None:
query_parameters['language'] = self._serialize.query("language", language, 'str')

Expand Down Expand Up @@ -989,7 +990,7 @@ def recognize_printed_text_in_stream(
recognize_printed_text_in_stream.metadata = {'url': '/ocr'}

def describe_image_in_stream(
self, image, max_candidates="1", language="en", custom_headers=None, raw=False, callback=None, **operation_config):
self, image, max_candidates=1, language="en", custom_headers=None, raw=False, callback=None, **operation_config):
"""This operation generates a description of an image in human readable
language with complete sentences. The description is based on a
collection of content tags, which are also returned by the operation.
Expand All @@ -1004,7 +1005,7 @@ def describe_image_in_stream(
:type image: Generator
:param max_candidates: Maximum number of candidate descriptions to be
returned. The default is 1.
:type max_candidates: str
:type max_candidates: int
:param language: The desired language for output generation. If this
parameter is not specified, the default value is
"en".Supported languages:en - English, Default. es -
Expand Down Expand Up @@ -1038,7 +1039,7 @@ def describe_image_in_stream(
# Construct parameters
query_parameters = {}
if max_candidates is not None:
query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'str')
query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'int')
if language is not None:
query_parameters['language'] = self._serialize.query("language", language, 'str')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class ImageType(Model):
"""An object providing possible image types and matching confidence levels.

:param clip_art_type: Confidence level that the image is a clip art.
:type clip_art_type: float
:type clip_art_type: int
:param line_drawing_type: Confidence level that the image is a line
drawing.
:type line_drawing_type: float
:type line_drawing_type: int
"""

_attribute_map = {
'clip_art_type': {'key': 'clipArtType', 'type': 'float'},
'line_drawing_type': {'key': 'lineDrawingType', 'type': 'float'},
'clip_art_type': {'key': 'clipArtType', 'type': 'int'},
'line_drawing_type': {'key': 'lineDrawingType', 'type': 'int'},
}

def __init__(self, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ class ImageType(Model):
"""An object providing possible image types and matching confidence levels.

:param clip_art_type: Confidence level that the image is a clip art.
:type clip_art_type: float
:type clip_art_type: int
:param line_drawing_type: Confidence level that the image is a line
drawing.
:type line_drawing_type: float
:type line_drawing_type: int
"""

_attribute_map = {
'clip_art_type': {'key': 'clipArtType', 'type': 'float'},
'line_drawing_type': {'key': 'lineDrawingType', 'type': 'float'},
'clip_art_type': {'key': 'clipArtType', 'type': 'int'},
'line_drawing_type': {'key': 'lineDrawingType', 'type': 'int'},
}

def __init__(self, *, clip_art_type: float=None, line_drawing_type: float=None, **kwargs) -> None:
def __init__(self, *, clip_art_type: int=None, line_drawing_type: int=None, **kwargs) -> None:
super(ImageType, self).__init__(**kwargs)
self.clip_art_type = clip_art_type
self.line_drawing_type = line_drawing_type