Links

Using PIP Python Package

iApp Technology just released a PIP Python Package on Face Passive Liveness Detection.
For easing the python development using iApp AI API service, we have released the iapp_ai python pip package. It is the api client library for iApp AI API service for python.

Installation

$ pip install iapp_ai
Note: It can be either pip or pip3 depend on your environment.

Calling Face Passive Liveness Detection API

# Face Passive Liveness API required an image file path
# Obtain taskGuid
taskGuid = api.face_liveness("iapp_ai/media/passport.jpg").json()
# calling face liveness information API with taskGuid (required taskGuid)
api.info_face_liveness(taskGuid=str(taskGuid)).json()

Example Usages

import iapp_ai
# You can request API key at https://ai.iapp.co.th
apikey = 'XXXXX_Your_API_Key_XXXXX'
api = iapp_ai.api(apikey)
# Face Passive Liveness API required an image file path
# Obtain taskGuid
taskGuid = api.face_liveness("iapp_ai/media/passport.jpg").json()
# calling face liveness information API with taskGuid (required taskGuid)
result = api.info_face_liveness(taskGuid=str(taskGuid)).json()
print(result)
# {
# 'contentLength': 150742,
# 'createdDate': '2022-05-27T20:21:16.217',
# 'duration': None,
# 'errorMessage': None,
# 'id': 2332,
# 'imageHeight': 552,
# 'imageWidth': 830,
# 'livenessDetected': False,
# 'livenessScore': None,
# 'mediaType': 'image/jpeg',
# 'referencedId': None,
# 'status': None,
# 'taskGuid': 'ebf0dbdc-a2a2-44f5-a617-f7b85f8fd004',
# 'updatedDate': None
# }

Full Example in Google Colaboratory

Google Colaboratory
Full Example of iApp AI API in Google Colaboratory