Skip to main content

Python SDK for the Cognitive Face API

Project description

# Microsoft Face API: Python SDK & Sample
This repo contains the Python SDK for the Microsoft Face API, an offering within [Microsoft Cognitive Services](, formerly known as Project Oxford.

* [Learn about the Face API](
* [Documentation & API Reference & SDKs](

## 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.

BASE_URL = '' # Replace with your regional Base URL

img_url = ''
result = CF.face.detect(img_url)
print result

### Installing from the source code

python 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/` into `cognitive_face/tests/`.
1. Change the `KEY` and `BASE_URL` parameters to your own subscription's API key and endpoint.
1. Run the following:

python 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]**
1. [Python 2]( + [wxPython 4](
1. [Python 2]( + [wxPython 3](

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

Then run the following:

git clone
cd Cognitive-Face-Python
pip install -r requirements.txt
python sample

![Sample app](./Assets/sample_screenshot.png)

## 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:
- **Support questions:** [StackOverflow](
- **Feedback & feature requests:** [Cognitive Services UserVoice Forum](

This project has adopted the [Microsoft Open Source Code of Conduct]( For more information see the [Code of Conduct FAQ]( or contact []( with any additional questions or comments.

## Updates
* [Face API Release Notes](

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

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 [](

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
cognitive_face-1.4.2-py3-none-any.whl (29.0 kB) Copy SHA256 hash SHA256 Wheel py3
cognitive_face-1.4.2.tar.gz (18.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page