Using PIP Python Package
iApp Technology just released a PIP Python Package on Thai National ID Card OCR.
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 Thai National ID Card API

  • Front Part of ID Card
1
# ID Card Front required an image file path
2
api.idcard_front("iapp_ai/media/id-card-front.jpg").json()
Copied!
  • Back Part of ID Card
1
# ID Card Back required an image file path
2
api.idcard_back("iapp_ai/media/id-card-back.jpg").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
# ID Card Front required an image file path.
10
result = api.idcard_front("iapp_ai/media/id-card-front.jpg").json()
11
print(result)
12
13
# {
14
# 'address': '23/20 หมู่ที่ 6 ต.กะทู้ อ.กะทู้ จ.ภูเก็ต',
15
# 'detection_score': 0.9645371039708456,
16
# 'district': 'กะทู้',
17
# 'en_dob': '11 Mar 1965',
18
# ...
19
# }
20
21
# ID Card Back required an image file path.
22
result = api.idcard_back("iapp_ai/media/id-card-back.jpg").json()
23
print(result)
24
25
# {
26
# 'back_number': 'JT0-1740123-05',
27
# 'detection_score': 0.9985906680425007,
28
# 'process_time': 1.4462785720825195,
29
# 'request_id': '05cf8d26-bd53-4357-8e5b-1962bf24ee04#1822'
30
# }
Copied!

Full Example in Google Colaboratory

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