Sample Application

Linux-ID Document Recognition SDK Flask, Gradio Demo

Installation

- Download

Download ID_SDK.zip

The Demo directory contains the following directories and files:

dependency\

Dependency files

engine\

SDK engine files

examples\

Sample images

flask\

Flask server side demo code

gradio\

Gradio demo code

install.txt

Install guide

license.txt

License key file

requirements.txt

Python requirements file

- Install dependencies

Follow the install.txt guide to install dependencies:

sudo apt-get update -y
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libopencv-dev libpcsclite-dev

sudo cp -f dependency/libimutils.so /usr/lib
sudo cp -f dependency/libttvcore.so /usr/lib

pip install -r requirements.txt

- Setting Up SDK License Key

  • Online Licensing: Set the online license key as an environment variable:

export LICENSE_KEY="XXXXX-XXXXX-XXXXX-XXXXX"
  • Offline Licensing: Copy the license.txt license file to the demo directory.


Test

- Run Demo

Run the demo script with the desired option:

cd flask
python app.py

- Test Flask Server APIs

To test the Flask Server API, you can use Postman. Here are the endpoints for testing:

POST /api/read_idcard

Extract data from ID card.

Parameters

image: image file for the front of ID card

image2: image file for the back of ID card

Response

data: OCR result

POST /api/read_idcard_base64

Extract data from ID card base64 images.

Parameters

image1: base64 image for the front image

image2: base64 image for the back image

Response

data: OCR result

- Test Gradio

Go to http://127.0.0.1:7860/ on a web browser.

Last updated