Skip to content

Commit

Permalink
Merge branch 'master' into restapi_auto_servicefabric/data-plane
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel authored Nov 29, 2018
2 parents c5e4cd6 + ec18d0b commit 7d59a31
Show file tree
Hide file tree
Showing 1,421 changed files with 102,077 additions and 5,441 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ src/build
*.pubxml

# [begoldsm] ignore virtual env if it exists.
adlEnv/
adlEnv/

code_reports
8 changes: 8 additions & 0 deletions azure-cognitiveservices-vision-customvision/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Release History
===============

0.4.0 (2018-11-13)
++++++++++++++++++

- The API client name was changed from TrainingAPI to CustomVisionTrainingClient, in keeping with other Azure SDKs.
- The way the Azure region is specfied has changed. Specifically, the AzureRegion property was dropped in favor of an Endpoint property. If you were previously specifying an AzureRegion value, you should now specify Endpoint='https://{AzureRegion}.api.cognitive.microsoft.com' instead. This change ensures better global coverage.
- Added ONNX 1.2 as an export option
- Added negative tag support.

0.3.0 (2018-07-12)
++++++++++++++++++

Expand Down
4 changes: 4 additions & 0 deletions azure-cognitiveservices-vision-customvision/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include *.rst
include azure/__init__.py
include azure/cognitiveservices/__init__.py
include azure/cognitiveservices/vision/__init__.py

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .prediction_endpoint import PredictionEndpoint
from .custom_vision_prediction_client import CustomVisionPredictionClient
from .version import VERSION

__all__ = ['PredictionEndpoint']
__all__ = ['CustomVisionPredictionClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,51 @@
from . import models


class PredictionEndpointConfiguration(Configuration):
"""Configuration for PredictionEndpoint
class CustomVisionPredictionClientConfiguration(Configuration):
"""Configuration for CustomVisionPredictionClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param api_key:
:type api_key: str
:param str base_url: Service URL
:param endpoint: Supported Cognitive Services endpoints
:type endpoint: str
"""

def __init__(
self, api_key, base_url=None):
self, api_key, endpoint):

if api_key is None:
raise ValueError("Parameter 'api_key' must not be None.")
if not base_url:
base_url = 'https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction'
if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
base_url = '{Endpoint}/customvision/v2.0/Prediction'

super(PredictionEndpointConfiguration, self).__init__(base_url)
super(CustomVisionPredictionClientConfiguration, self).__init__(base_url)

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

self.api_key = api_key
self.endpoint = endpoint


class PredictionEndpoint(SDKClient):
"""PredictionEndpoint
class CustomVisionPredictionClient(SDKClient):
"""CustomVisionPredictionClient
:ivar config: Configuration for client.
:vartype config: PredictionEndpointConfiguration
:vartype config: CustomVisionPredictionClientConfiguration
:param api_key:
:type api_key: str
:param str base_url: Service URL
:param endpoint: Supported Cognitive Services endpoints
:type endpoint: str
"""

def __init__(
self, api_key, base_url=None):
self, api_key, endpoint):

self.config = PredictionEndpointConfiguration(api_key, base_url)
super(PredictionEndpoint, self).__init__(None, self.config)
self.config = CustomVisionPredictionClientConfiguration(api_key, endpoint)
super(CustomVisionPredictionClient, self).__init__(None, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2.0'
Expand Down Expand Up @@ -97,6 +101,7 @@ def predict_image_url(
# Construct URL
url = self.predict_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')
}
url = self._client.format_url(url, **path_format_arguments)
Expand All @@ -110,6 +115,7 @@ def predict_image_url(

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
Expand All @@ -119,9 +125,8 @@ def predict_image_url(
body_content = self._serialize.body(image_url, 'ImageUrl')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
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]:
raise HttpOperationError(self._deserialize, response)
Expand Down Expand Up @@ -168,6 +173,7 @@ def predict_image(
# Construct URL
url = self.predict_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')
}
url = self._client.format_url(url, **path_format_arguments)
Expand All @@ -181,6 +187,7 @@ def predict_image(

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'multipart/form-data'
if custom_headers:
header_parameters.update(custom_headers)
Expand All @@ -192,9 +199,8 @@ def predict_image(
}

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send_formdata(
request, header_parameters, form_data_content, stream=False, **operation_config)
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]:
raise HttpOperationError(self._deserialize, response)
Expand Down Expand Up @@ -243,6 +249,7 @@ def predict_image_url_with_no_store(
# Construct URL
url = self.predict_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')
}
url = self._client.format_url(url, **path_format_arguments)
Expand All @@ -256,6 +263,7 @@ def predict_image_url_with_no_store(

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
Expand All @@ -265,9 +273,8 @@ def predict_image_url_with_no_store(
body_content = self._serialize.body(image_url, 'ImageUrl')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
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]:
raise HttpOperationError(self._deserialize, response)
Expand Down Expand Up @@ -314,6 +321,7 @@ def predict_image_with_no_store(
# Construct URL
url = self.predict_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')
}
url = self._client.format_url(url, **path_format_arguments)
Expand All @@ -327,6 +335,7 @@ def predict_image_with_no_store(

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'multipart/form-data'
if custom_headers:
header_parameters.update(custom_headers)
Expand All @@ -338,9 +347,8 @@ def predict_image_with_no_store(
}

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send_formdata(
request, header_parameters, form_data_content, stream=False, **operation_config)
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]:
raise HttpOperationError(self._deserialize, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .training_api import TrainingApi
from .custom_vision_training_client import CustomVisionTrainingClient
from .version import VERSION

__all__ = ['TrainingApi']
__all__ = ['CustomVisionTrainingClient']

__version__ = VERSION

Loading

0 comments on commit 7d59a31

Please sign in to comment.