The First Face++ Python Program

Environment Settings.

1. Click here to download Facepp Python SDK, unzip the file. 2. Please make sure that the Python version is below Python 3.0 (not included). Currently we do not support Python 3.0, later we'll release python SDK with support to Python 3.0.

Configure hello.py

Before running your program, you should first open file "hello.py" and fill in the API Key and API Secret as follow. Save it.
API_KEY = 'YOUR_API_KEY'
API_SECRET = 'YOUR_API_SECRET'
API Key and API Secret can be found in any of your application management page in the application management system.

Run hello.py

In the command line, under your local directory "facepp-python-sdk-master", type the command "python hello.py" to run the program and view the results.
facepp-python-sdk-master$ python hello.py
Jim Parsons
  {'face': [{'attribute': {'age': {'range': 7, 'value': 33},
                           'gender': {'confidence': 99.9936,
                                      'value': 'Male'},
                           'race': {'confidence': 97.6082,
                                    'value': 'White'},
                           'smiling': {'value': 2.70393}},
             'face_id': '1f470bc56b3e361d90d87545e8b836af',
             'position': {'center': {'x': 42.19457, 'y': 24.166667},
                          'eye_left': {'x': 37.580317, 'y': 20.741},
                          'eye_right': {'x': 46.056561, 'y': 20.11},
                          'height': 13.333333,
                          'mouth_left': {'x': 39.800679, 'y': 27.785167},
                          'mouth_right': {'x': 46.00181, 'y': 27.373333},
                          'nose': {'x': 41.772398, 'y': 24.882167},
                          'width': 17.873303},
             'tag': ''}],
   'img_height': 1220,
   'img_id': '0cf42f603fc9ddcbf890f7b8d49b40d4',
   'img_width': 900,
   'session_id': '1f6e7ff3102d4a08a11da73dd04f47e8',
   'url': 'http://cn.faceplusplus.com/static/resources/python_demo/1.jpg'}
...
============================================================
The person with highest confidence: Jim Parsons
Google+