Skip to content

Commit

Permalink
Generated from 497f37d011e45d90e7a5f190b1326ec89e2719c8
Browse files Browse the repository at this point in the history
Merge pull request #6 from Khushboo-Baheti/master

merge
  • Loading branch information
SDK Automation committed Feb 24, 2020
1 parent a25a803 commit cd64259
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 468 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
# regenerated.
# --------------------------------------------------------------------------

from .custom_vision_prediction_client import CustomVisionPredictionClient
from .version import VERSION
from ._configuration import CustomVisionPredictionClientConfiguration
from ._custom_vision_prediction_client import CustomVisionPredictionClient
__all__ = ['CustomVisionPredictionClient', 'CustomVisionPredictionClientConfiguration']

__all__ = ['CustomVisionPredictionClient']
from .version import VERSION

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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 import Configuration

from .version import VERSION


class CustomVisionPredictionClientConfiguration(Configuration):
"""Configuration for CustomVisionPredictionClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param endpoint: Supported Cognitive Services endpoints.
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, endpoint, credentials):

if endpoint is None:
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'

super(CustomVisionPredictionClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True

self.add_user_agent('azure-cognitiveservices-vision-customvision/{}'.format(VERSION))

self.endpoint = endpoint
self.credentials = credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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.service_client import SDKClient
from msrest import Serializer, Deserializer

from ._configuration import CustomVisionPredictionClientConfiguration
from .operations import CustomVisionPredictionClientOperationsMixin
from . import models


class CustomVisionPredictionClient(CustomVisionPredictionClientOperationsMixin, SDKClient):
"""CustomVisionPredictionClient
:ivar config: Configuration for client.
:vartype config: CustomVisionPredictionClientConfiguration
:param endpoint: Supported Cognitive Services endpoints.
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, endpoint, credentials):

self.config = CustomVisionPredictionClientConfiguration(endpoint, credentials)
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._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
# --------------------------------------------------------------------------

try:
from .image_url_py3 import ImageUrl
from .bounding_box_py3 import BoundingBox
from .prediction_py3 import Prediction
from .image_prediction_py3 import ImagePrediction
from .custom_vision_error_py3 import CustomVisionError, CustomVisionErrorException
from ._models_py3 import BoundingBox
from ._models_py3 import CustomVisionError, CustomVisionErrorException
from ._models_py3 import ImagePrediction
from ._models_py3 import ImageUrl
from ._models_py3 import Prediction
except (SyntaxError, ImportError):
from .image_url import ImageUrl
from .bounding_box import BoundingBox
from .prediction import Prediction
from .image_prediction import ImagePrediction
from .custom_vision_error import CustomVisionError, CustomVisionErrorException
from .custom_vision_prediction_client_enums import (
from ._models import BoundingBox
from ._models import CustomVisionError, CustomVisionErrorException
from ._models import ImagePrediction
from ._models import ImageUrl
from ._models import Prediction
from ._custom_vision_prediction_client_enums import (
CustomVisionErrorCodes,
)

__all__ = [
'ImageUrl',
'BoundingBox',
'Prediction',
'ImagePrediction',
'CustomVisionError', 'CustomVisionErrorException',
'ImagePrediction',
'ImageUrl',
'Prediction',
'CustomVisionErrorCodes',
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@
from msrest.exceptions import HttpOperationError


class BoundingBox(Model):
"""Bounding box that defines a region of an image.
All required parameters must be populated in order to send to Azure.
:param left: Required. Coordinate of the left boundary.
:type left: float
:param top: Required. Coordinate of the top boundary.
:type top: float
:param width: Required. Width.
:type width: float
:param height: Required. Height.
:type height: float
"""

_validation = {
'left': {'required': True},
'top': {'required': True},
'width': {'required': True},
'height': {'required': True},
}

_attribute_map = {
'left': {'key': 'left', 'type': 'float'},
'top': {'key': 'top', 'type': 'float'},
'width': {'key': 'width', 'type': 'float'},
'height': {'key': 'height', 'type': 'float'},
}

def __init__(self, **kwargs):
super(BoundingBox, self).__init__(**kwargs)
self.left = kwargs.get('left', None)
self.top = kwargs.get('top', None)
self.width = kwargs.get('width', None)
self.height = kwargs.get('height', None)


class CustomVisionError(Model):
"""CustomVisionError.
Expand Down Expand Up @@ -116,3 +153,108 @@ class CustomVisionErrorException(HttpOperationError):
def __init__(self, deserialize, response, *args):

super(CustomVisionErrorException, self).__init__(deserialize, response, 'CustomVisionError', *args)


class ImagePrediction(Model):
"""Result of an image prediction request.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Prediction Id.
:vartype id: str
:ivar project: Project Id.
:vartype project: str
:ivar iteration: Iteration Id.
:vartype iteration: str
:ivar created: Date this prediction was created.
:vartype created: datetime
:ivar predictions: List of predictions.
:vartype predictions:
list[~azure.cognitiveservices.vision.customvision.prediction.models.Prediction]
"""

_validation = {
'id': {'readonly': True},
'project': {'readonly': True},
'iteration': {'readonly': True},
'created': {'readonly': True},
'predictions': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'project': {'key': 'project', 'type': 'str'},
'iteration': {'key': 'iteration', 'type': 'str'},
'created': {'key': 'created', 'type': 'iso-8601'},
'predictions': {'key': 'predictions', 'type': '[Prediction]'},
}

def __init__(self, **kwargs):
super(ImagePrediction, self).__init__(**kwargs)
self.id = None
self.project = None
self.iteration = None
self.created = None
self.predictions = None


class ImageUrl(Model):
"""Image url.
All required parameters must be populated in order to send to Azure.
:param url: Required. Url of the image.
:type url: str
"""

_validation = {
'url': {'required': True},
}

_attribute_map = {
'url': {'key': 'url', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ImageUrl, self).__init__(**kwargs)
self.url = kwargs.get('url', None)


class Prediction(Model):
"""Prediction result.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar probability: Probability of the tag.
:vartype probability: float
:ivar tag_id: Id of the predicted tag.
:vartype tag_id: str
:ivar tag_name: Name of the predicted tag.
:vartype tag_name: str
:ivar bounding_box: Bounding box of the prediction.
:vartype bounding_box:
~azure.cognitiveservices.vision.customvision.prediction.models.BoundingBox
"""

_validation = {
'probability': {'readonly': True},
'tag_id': {'readonly': True},
'tag_name': {'readonly': True},
'bounding_box': {'readonly': True},
}

_attribute_map = {
'probability': {'key': 'probability', 'type': 'float'},
'tag_id': {'key': 'tagId', 'type': 'str'},
'tag_name': {'key': 'tagName', 'type': 'str'},
'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'},
}

def __init__(self, **kwargs):
super(Prediction, self).__init__(**kwargs)
self.probability = None
self.tag_id = None
self.tag_name = None
self.bounding_box = None
Loading

0 comments on commit cd64259

Please sign in to comment.