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
$pipinstalliapp_ai
Note: It can be either pip or pip3 depend on your environment.
Calling Thai National ID Card API
Front Part of ID Card
# ID Card Front required an image file pathapi.idcard_front("iapp_ai/media/id-card-front.jpg").json()
Back Part of ID Card
# ID Card Back required an image file pathapi.idcard_back("iapp_ai/media/id-card-back.jpg").json()
Example Usages
import iapp_ai# You can request API key at https://ai.iapp.co.thapikey ='XXXXX_Your_API_Key_XXXXX'api = iapp_ai.api(apikey)# ID Card Front required an image file path.result = api.idcard_front("iapp_ai/media/id-card-front.jpg").json()print(result)# {# 'address': '23/20 หมู่ที่ 6 ต.กะทู้ อ.กะทู้ จ.ภูเก็ต',# 'detection_score': 0.9645371039708456,# 'district': 'กะทู้',# 'en_dob': '11 Mar 1965',# ...# }# ID Card Back required an image file path.result = api.idcard_back("iapp_ai/media/id-card-back.jpg").json()print(result)# {# 'back_number': 'JT0-1740123-05',# 'detection_score': 0.9985906680425007,# 'process_time': 1.4462785720825195,# 'request_id': '05cf8d26-bd53-4357-8e5b-1962bf24ee04#1822'# }