Skip to content

Commit

Permalink
FaceAPI preview
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Oct 19, 2017
1 parent e44d3b7 commit 6e5b1fc
Show file tree
Hide file tree
Showing 55 changed files with 4,808 additions and 0 deletions.
9 changes: 9 additions & 0 deletions azure-cognitiveservices-vision/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:
Release History
===============

0.1.0 (1970-01-01)
++++++++++++++++++

* Initial Release
2 changes: 2 additions & 0 deletions azure-cognitiveservices-vision/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.rst
include azure_bdist_wheel.py
49 changes: 49 additions & 0 deletions azure-cognitiveservices-vision/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure Cognitive Services Vision Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.3, 3.4, 3.5 and 3.6.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.

For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/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
=====

For code examples, see `Cognitive Services Vision
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-cognitiveservices-vision.html>`__
on readthedocs.org.


Provide Feedback
================

If you encounter any bugs or have suggestions, please file an issue in the
`Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__
section of the project.
1 change: 1 addition & 0 deletions azure-cognitiveservices-vision/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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 .face_api import FaceAPI
from .version import VERSION

__all__ = ['FaceAPI']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"autorest": [
{
"resolvedInfo": null,
"packageMetadata": {
"name": "@microsoft.azure/autorest-core",
"version": "2.0.4168",
"engines": {
"node": ">=7.10.0"
},
"dependencies": {},
"optionalDependencies": {},
"devDependencies": {
"@microsoft.azure/async-io": "~1.0.22",
"@microsoft.azure/extension": "~1.2.12",
"@types/commonmark": "^0.27.0",
"@types/jsonpath": "^0.1.29",
"@types/node": "^8.0.28",
"@types/pify": "0.0.28",
"@types/source-map": "^0.5.0",
"@types/yargs": "^8.0.2",
"commonmark": "^0.27.0",
"file-url": "^2.0.2",
"get-uri": "^2.0.0",
"jsonpath": "^0.2.11",
"linq-es2015": "^2.4.25",
"mocha": "3.4.2",
"mocha-typescript": "1.1.5",
"pify": "^3.0.0",
"safe-eval": "^0.3.0",
"shx": "^0.2.2",
"source-map": "^0.5.6",
"source-map-support": "^0.4.15",
"strip-bom": "^3.0.0",
"typescript": "2.5.3",
"untildify": "^3.0.2",
"urijs": "^1.18.10",
"vscode-jsonrpc": "^3.3.1",
"yaml-ast-parser": "https://github.com/olydis/yaml-ast-parser/releases/download/0.0.34/yaml-ast-parser-0.0.34.tgz",
"yargs": "^8.0.2"
},
"bundleDependencies": false,
"peerDependencies": {},
"deprecated": false,
"_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4168/node_modules/@microsoft.azure/autorest-core",
"_shasum": "33813111fc9bfa488bd600fbba48bc53cc9182c7",
"_shrinkwrap": null,
"bin": null,
"_id": "@microsoft.azure/autorest-core@2.0.4168",
"_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4168/node_modules/@microsoft.azure/autorest-core",
"_requested": {
"type": "directory",
"where": "C:\\Users\\lmazuel\\Git\\swagger-to-sdk",
"raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4168\\node_modules\\@microsoft.azure\\autorest-core",
"rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4168\\node_modules\\@microsoft.azure\\autorest-core",
"saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4168/node_modules/@microsoft.azure/autorest-core",
"fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4168/node_modules/@microsoft.azure/autorest-core"
},
"_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4168\\node_modules\\@microsoft.azure\\autorest-core",
"_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4168\\node_modules\\@microsoft.azure\\autorest-core"
},
"extensionManager": {
"installationPath": "C:\\Users\\lmazuel\\.autorest",
"dotnetPath": "C:\\Users\\lmazuel\\.dotnet"
},
"installationPath": "C:\\Users\\lmazuel\\.autorest"
},
{
"resolvedInfo": null,
"packageMetadata": {
"name": "@microsoft.azure/autorest.modeler",
"version": "2.1.22",
"dependencies": {
"dotnet-2.0.0": "^1.4.4"
},
"optionalDependencies": {},
"devDependencies": {
"coffee-script": "^1.11.1",
"dotnet-sdk-2.0.0": "^1.4.4",
"gulp": "^3.9.1",
"gulp-filter": "^5.0.0",
"gulp-line-ending-corrector": "^1.0.1",
"iced-coffee-script": "^108.0.11",
"marked": "^0.3.6",
"marked-terminal": "^2.0.0",
"moment": "^2.17.1",
"run-sequence": "*",
"shx": "^0.2.2",
"through2-parallel": "^0.1.3",
"yargs": "^8.0.2",
"yarn": "^1.0.2"
},
"bundleDependencies": false,
"peerDependencies": {},
"deprecated": false,
"_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.1.22/node_modules/@microsoft.azure/autorest.modeler",
"_shasum": "ca425289fa38a210d279729048a4a91673f09c67",
"_shrinkwrap": null,
"bin": null,
"_id": "@microsoft.azure/autorest.modeler@2.1.22",
"_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.1.22/node_modules/@microsoft.azure/autorest.modeler",
"_requested": {
"type": "directory",
"where": "C:\\Users\\lmazuel\\Git\\swagger-to-sdk",
"raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.1.22\\node_modules\\@microsoft.azure\\autorest.modeler",
"rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.1.22\\node_modules\\@microsoft.azure\\autorest.modeler",
"saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.1.22/node_modules/@microsoft.azure/autorest.modeler",
"fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.1.22/node_modules/@microsoft.azure/autorest.modeler"
},
"_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.1.22\\node_modules\\@microsoft.azure\\autorest.modeler",
"_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.1.22\\node_modules\\@microsoft.azure\\autorest.modeler"
},
"extensionManager": {
"installationPath": "C:\\Users\\lmazuel\\.autorest",
"dotnetPath": "C:\\Users\\lmazuel\\.dotnet"
},
"installationPath": "C:\\Users\\lmazuel\\.autorest"
},
{
"resolvedInfo": null,
"packageMetadata": {
"name": "@microsoft.azure/autorest.python",
"version": "2.0.19",
"dependencies": {
"dotnet-2.0.0": "^1.4.4"
},
"optionalDependencies": {},
"devDependencies": {
"@microsoft.azure/autorest.testserver": "^1.9.0",
"autorest": "^2.0.0",
"coffee-script": "^1.11.1",
"dotnet-sdk-2.0.0": "^1.4.4",
"gulp": "^3.9.1",
"gulp-filter": "^5.0.0",
"gulp-line-ending-corrector": "^1.0.1",
"iced-coffee-script": "^108.0.11",
"marked": "^0.3.6",
"marked-terminal": "^2.0.0",
"moment": "^2.17.1",
"run-sequence": "*",
"shx": "^0.2.2",
"through2-parallel": "^0.1.3",
"yargs": "^8.0.2",
"yarn": "^1.0.2"
},
"bundleDependencies": false,
"peerDependencies": {},
"deprecated": false,
"_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.0.19/node_modules/@microsoft.azure/autorest.python",
"_shasum": "e069166c16fd903c8e1fdf9395b433f3043cb6e3",
"_shrinkwrap": null,
"bin": null,
"_id": "@microsoft.azure/autorest.python@2.0.19",
"_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.0.19/node_modules/@microsoft.azure/autorest.python",
"_requested": {
"type": "directory",
"where": "C:\\Users\\lmazuel\\Git\\swagger-to-sdk",
"raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.0.19\\node_modules\\@microsoft.azure\\autorest.python",
"rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.0.19\\node_modules\\@microsoft.azure\\autorest.python",
"saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.0.19/node_modules/@microsoft.azure/autorest.python",
"fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.0.19/node_modules/@microsoft.azure/autorest.python"
},
"_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.0.19\\node_modules\\@microsoft.azure\\autorest.python",
"_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.0.19\\node_modules\\@microsoft.azure\\autorest.python"
},
"extensionManager": {
"installationPath": "C:\\Users\\lmazuel\\.autorest",
"dotnetPath": "C:\\Users\\lmazuel\\.dotnet"
},
"installationPath": "C:\\Users\\lmazuel\\.autorest"
}
],
"autorest_bootstrap": {
"dependencies": {
"autorest": {
"version": "2.0.4166",
"from": "autorest",
"resolved": "https://registry.npmjs.org/autorest/-/autorest-2.0.4166.tgz"
}
}
},
"date": "2017-10-19T22:27:56Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# 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 ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.face_operations import FaceOperations
from .operations.person_operations import PersonOperations
from .operations.person_group_operations import PersonGroupOperations
from .operations.face_list_operations import FaceListOperations
from . import models


class FaceAPIConfiguration(Configuration):
"""Configuration for FaceAPI
Note that all parameters used to create this instance are saved as instance
attributes.
:param subscription_key: Subscription key in header
:type subscription_key: str
:param azure_region: Supported Azure regions for Cognitive Services
endpoints. Possible values include: 'westus', 'westeurope',
'southeastasia', 'eastus2', 'westcentralus'
:type azure_region: str or
~azure.cognitiveservices.vision.face.models.AzureRegions
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, subscription_key, azure_region, credentials):

if subscription_key is None:
raise ValueError("Parameter 'subscription_key' must not be None.")
if azure_region is None:
raise ValueError("Parameter 'azure_region' must not be None.")
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
base_url = 'https://{AzureRegion}.api.cognitive.microsoft.com/face/v1.0'

super(FaceAPIConfiguration, self).__init__(base_url)

self.add_user_agent('faceapi/{}'.format(VERSION))

self.subscription_key = subscription_key
self.azure_region = azure_region
self.credentials = credentials


class FaceAPI(object):
"""An API for face detection, verification, and identification.
:ivar config: Configuration for client.
:vartype config: FaceAPIConfiguration
:ivar face: Face operations
:vartype face: azure.cognitiveservices.vision.face.operations.FaceOperations
:ivar person: Person operations
:vartype person: azure.cognitiveservices.vision.face.operations.PersonOperations
:ivar person_group: PersonGroup operations
:vartype person_group: azure.cognitiveservices.vision.face.operations.PersonGroupOperations
:ivar face_list: FaceList operations
:vartype face_list: azure.cognitiveservices.vision.face.operations.FaceListOperations
:param subscription_key: Subscription key in header
:type subscription_key: str
:param azure_region: Supported Azure regions for Cognitive Services
endpoints. Possible values include: 'westus', 'westeurope',
'southeastasia', 'eastus2', 'westcentralus'
:type azure_region: str or
~azure.cognitiveservices.vision.face.models.AzureRegions
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, subscription_key, azure_region, credentials):

self.config = FaceAPIConfiguration(subscription_key, azure_region, credentials)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.face = FaceOperations(
self._client, self.config, self._serialize, self._deserialize)
self.person = PersonOperations(
self._client, self.config, self._serialize, self._deserialize)
self.person_group = PersonGroupOperations(
self._client, self.config, self._serialize, self._deserialize)
self.face_list = FaceListOperations(
self._client, self.config, self._serialize, self._deserialize)
Loading

0 comments on commit 6e5b1fc

Please sign in to comment.