> For the complete documentation index, see [llms.txt](https://docs.recognito.vision/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.recognito.vision/id-document-recognition-sdk/integration-guide/linux/sample-application.md).

# Sample Application

## Docker

Pull the Docker image and run the container:

{% code overflow="wrap" %}

```sh
sudo docker pull recognito/id-ocr:latest
sudo docker run -it -e LICENSE_KEY="XXXXX-XXXXX-XXXXX-XXXXX" -p 8001:8000 -p 7861:7860 recognito/id-ocr:latest [OPTION --gradio(-g), --flask(-f)]
```

{% endcode %}

## Installation

### - Download

Download [**ID\_SDK.zip**](https://www.dropbox.com/scl/fi/raa1tcvw0fvupjr3tgqui/ID_SDK.zip?rlkey=44ummljjmqbi176kokzlmious\&st=n6m2twsr\&dl=0)

The Demo directory contains the following directories and files:

<table data-header-hidden><thead><tr><th width="206"></th><th></th></tr></thead><tbody><tr><td><strong>dependency\</strong></td><td>Dependency files</td></tr><tr><td><strong>engine\</strong></td><td>SDK engine files</td></tr><tr><td><strong>examples\</strong></td><td>Sample images</td></tr><tr><td><strong>flask\</strong></td><td>Flask server side demo code</td></tr><tr><td><strong>gradio\</strong></td><td>Gradio demo code</td></tr><tr><td>Dockerfile</td><td>Dockerfile for building a Docker image</td></tr><tr><td>install.sh</td><td>Script for install environment</td></tr><tr><td>license.txt</td><td>License key file</td></tr><tr><td>run_demo.sh</td><td>Script for run demo</td></tr></tbody></table>

### - Install dependencies

Run the `install.sh` script to install dependencies:

```sh
./install.sh
```

### - Setting Up SDK License Key

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

{% code overflow="wrap" %}

```sh
export LICENSE_KEY="XXXXX-XXXXX-XXXXX-XXXXX"
```

{% endcode %}

* **Offline Licensing:** Copy the `license.txt` license file to the demo directory.

***

## Test

### - Run Demo

Run the demo script with the desired option:

{% code overflow="wrap" %}

```sh
./run_demo.sh [OPTION --gradio(-g), --flask(-f), --help(-h)]
```

{% endcode %}

<figure><img src="/files/gaOsnVIFbOvrWZyCYzI6" alt=""><figcaption></figcaption></figure>

### - Test Flask Server APIs

To test the Flask Server API, you can use [Postman](https://www.postman.com/downloads/). Here are the endpoints for testing:

#### &#x20; <mark style="background-color:blue;">POST</mark> /api/read\_idcard

&#x20; Extract data from ID card.

&#x20;   **Parameters**

&#x20;        **image:** image file for the front of ID card

&#x20;        **image2:** image file for the back of ID card

&#x20;   **Response**&#x20;

&#x20;        **data:** OCR result

#### &#x20; <mark style="background-color:blue;">POST</mark> /api/read\_idcard\_base64

&#x20; Extract data from ID card base64 images.

&#x20;   **Parameters**

&#x20;        **image1:** base64 image for the front image

&#x20;        **image2:** base64 image for the back image

&#x20;   **Response**&#x20;

&#x20;        **data:** OCR result

<figure><img src="/files/r7bgvHHhdri7aOx8OLur" alt=""><figcaption><p>Postman usage guide for Flask Demo</p></figcaption></figure>

### - Test Gradio

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

<figure><img src="/files/KsgsBCWMp4MEDuWt7hNh" alt=""><figcaption><p>Gradio Demo</p></figcaption></figure>

<div><figure><img src="/files/CzFTfIfZ2uWD0ZESCShb" alt=""><figcaption></figcaption></figure> <figure><img src="/files/j2DccQ7Wa02jkro4XcTG" alt=""><figcaption></figcaption></figure> <figure><img src="/files/TU8GYmsjx7yWOyGlf9MQ" alt=""><figcaption></figcaption></figure></div>
