Skip to main content

Python SDK for the Cognitive Face API

Project description

Microsoft Face API: Python SDK & Sample

PyPi Version License

This SDK has been deprecated and been replaced by Microsoft.Azure.CognitiveServices.Vision.Face which is a part of Azure SDK.

This repo contains the Python SDK for the Microsoft Face API, an offering within Microsoft Cognitive Services, formerly known as Project Oxford.

Getting started

Install the module using pip:

pip install cognitive_face

Use it:

import cognitive_face as CF

KEY = 'subscription key'  # Replace with a valid Subscription Key here.
CF.Key.set(KEY)

BASE_URL = 'https://westus.api.cognitive.microsoft.com/face/v1.0/'  # Replace with your regional Base URL
CF.BaseUrl.set(BASE_URL)

img_url = 'https://raw.githubusercontent.com/Microsoft/Cognitive-Face-Windows/master/Data/detection1.jpg'
result = CF.face.detect(img_url)
print result

Installing from the source code

python setup.py install

Running the unit tests

To run the tests you will need a valid subscription. You can get one here.

  1. Copy cognitive_face/tests/config.sample.py into cognitive_face/tests/config.py.
  2. Change the KEY and BASE_URL parameters to your own subscription's API key and endpoint.
  3. Run the following:
python setup.py test

Running the sample

A sample desktop application is also provided.

Currently it support the following combination of prerequisites:

  1. Python 3 + wxPython 4 [Recommended]
  2. Python 2 + wxPython 4
  3. Python 2 + wxPython 3

P.S. WxPython 3 does not support Python 3 by design.

Then run the following:

git clone https://github.com/Microsoft/Cognitive-Face-Python.git
cd Cognitive-Face-Python
pip install -r requirements.txt
python sample

Sample app

Contributing

We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can. Learn more about how you can help on our Contribution Rules & Guidelines.

You can reach out to us anytime with questions and suggestions using our communities below:

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Updates

License

All Microsoft Cognitive Services SDKs and samples are licensed with the MIT License. For more details, see LICENSE.

Sample images are licensed separately, please refer to LICENSE-IMAGE.

Developer Code of Conduct

Developers using Cognitive Services, including this sample, are expected to follow the “Developer Code of Conduct for Microsoft Cognitive Services”, found at http://go.microsoft.com/fwlink/?LinkId=698895.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cognitive_face-1.5.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

cognitive_face-1.5.0-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file cognitive_face-1.5.0.tar.gz.

File metadata

  • Download URL: cognitive_face-1.5.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for cognitive_face-1.5.0.tar.gz
Algorithm Hash digest
SHA256 ef4fd24cdfa21ba24320a80dedfa8bbe283350b51db36aa9fbb924d69595bb73
MD5 af62affc257a4f2e51d361e5d6ce221c
BLAKE2b-256 844224f0f6a3a93095911fd1444370ce66dc7cc76e4737a9e2bf51d092b8bea9

See more details on using hashes here.

File details

Details for the file cognitive_face-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: cognitive_face-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for cognitive_face-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e486e78000288fbb00c2ccd42e0d1e09ba1a63fe9c78497d7b1d88b49d41828a
MD5 8275125937cf89fc418382bba222a36e
BLAKE2b-256 5916d332bf7de96d651e9f83dfe15c2b7e2bf47beea73b72f9aa1d35884e3fcb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page