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

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

Calling Face Passive Liveness Detection API

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

Example Usages

1
import iapp_ai
2
3
4
# You can request API key at https://ai.iapp.co.th
5
apikey = 'XXXXX_Your_API_Key_XXXXX'
6
7
api = iapp_ai.api(apikey)
8
9
# Face Passive Liveness API required an image file path
10
# Obtain taskGuid
11
taskGuid = api.face_liveness("iapp_ai/media/passport.jpg").json()
12
# calling face liveness information API with taskGuid (required taskGuid)
13
result = api.info_face_liveness(taskGuid=str(taskGuid)).json()
14
print(result)
15
16
# {
17
# 'contentLength': 150742,
18
# 'createdDate': '2022-05-27T20:21:16.217',
19
# 'duration': None,
20
# 'errorMessage': None,
21
# 'id': 2332,
22
# 'imageHeight': 552,
23
# 'imageWidth': 830,
24
# 'livenessDetected': False,
25
# 'livenessScore': None,
26
# 'mediaType': 'image/jpeg',
27
# 'referencedId': None,
28
# 'status': None,
29
# 'taskGuid': 'ebf0dbdc-a2a2-44f5-a617-f7b85f8fd004',
30
# 'updatedDate': None
31
# }
32
Copied!

Full Example in Google Colaboratory

Google Colaboratory
Full Example of iApp AI API in Google Colaboratory
Copy link
Contents