Skip to main content

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.

Release files for cognitive-face 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognitive-face 1.5.0
File Size Uploaded
cognitive_face-1.5.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cognitive-face 1.5.0
File Interpreter ABI Platform
cognitive_face-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.7 kB

Release files / cognitive_face-1.5.0.tar.gz

Download URL cognitive_face-1.5.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ef4fd24cdfa21ba24320a80dedfa8bbe283350b51db36aa9fbb924d69595bb73
BLAKE2b-256 checksum
How to use checksums
844224f0f6a3a93095911fd1444370ce66dc7cc76e4737a9e2bf51d092b8bea9
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / cognitive_face-1.5.0-py3-none-any.whl

Download URL cognitive_face-1.5.0-py3-none-any.whl
Size 30.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e486e78000288fbb00c2ccd42e0d1e09ba1a63fe9c78497d7b1d88b49d41828a
BLAKE2b-256 checksum
How to use checksums
5916d332bf7de96d651e9f83dfe15c2b7e2bf47beea73b72f9aa1d35884e3fcb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

1 release file

1.3.0

1 release file

1.2.5

1 release file

1.2.1

1 release file

1.2.0

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page