# Sample Application

## Installation

### - Download

Download [**WinFaceSDKDemo.rar \[145M\]**](https://www.dropbox.com/scl/fi/jxqqbtgz77d1ehj11pynv/WinFaceSDKDemo.rar?rlkey=7abi2u51e8kg3bvgrt37rj9u8\&st=undfe1s7\&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><strong>video_surveillance_demo\</strong></td><td>1:N Video Surveillance demo code</td></tr></tbody></table>

### - Install dependencies

Install `python-3.8.9.exe`, `VC_redist.2013.exe`, `VC_redist.2015-2022.exe` files from `dependency` directory.

{% hint style="warning" %}
When install `python-3.8.9.exe`, have to tick the `Add Python3.8 to PATH` option.

<img src="/files/KH9f4qKZ6cPflsoxKEG7" alt="" data-size="original">
{% endhint %}

### - Setting Up SDK License Key

Copy the `license.txt` license file to the `engine` directory.

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

***

## Test

### - Test Flask Server APIs

* Install sub-dependencies for Flask Demo

{% code overflow="wrap" %}

```sh
cd flask
python -m pip install -r requirements.txt
```

{% endcode %}

* Run `app.py` script:

{% code overflow="wrap" %}

```shell
python app.py
```

{% endcode %}

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

* 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/analyze\_face

&#x20; Perform face analysis on an image file

&#x20;   **Parameters**

&#x20;        **image:** image file

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

&#x20;        **result:** face detection result

&#x20;        **face\_rect:** face bounding box of detected face

&#x20;        **attribute:** attributes(age, gender, liveness, mask,  wear\_glass) of detected face

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

&#x20; Perform face match between two face image files

&#x20;   **Parameters**

&#x20;        **image1:** image file for the 1st face

&#x20;        **image2:** image file for the 2nd face

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

&#x20;        **result:** face match result

&#x20;        **similarity:** similarity between two faces

&#x20;        **detection:** face bounding boxes of two faces

<figure><img src="/files/Rx0NCK0ldH6YpQ8BSgOx" alt=""><figcaption><p>Postman usage guide for Flask Demo (analyze_face)</p></figcaption></figure>

<figure><img src="/files/fCUlE6PkuBTk2MloW6Yw" alt=""><figcaption><p>Postman usage guide for Flask Demo (compare_face)</p></figcaption></figure>

### - Test Gradio

* Install sub-dependencies for Gradio Demo

{% code overflow="wrap" %}

```sh
cd gradio
python -m pip install -r requirements.txt
```

{% endcode %}

* Run `app.py` script:

{% code overflow="wrap" %}

```shell
python app.py
```

{% endcode %}

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

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

<figure><img src="/files/bNstcjGQyIsOi3HXG0CD" alt=""><figcaption><p>Gradio Demo (face attribute)</p></figcaption></figure>

<figure><img src="/files/lpboPVhZefBxYuRsRy2k" alt=""><figcaption><p>Gradio Demo (face recognition)</p></figcaption></figure>

### - Test 1:N Surveillance

* Install sub-dependencies for Surveillance Demo

{% code overflow="wrap" %}

```sh
cd video_surveillance_demo
python -m pip install -r requirements.txt
```

{% endcode %}

* Run `app.py` script:

{% code overflow="wrap" %}

```shell
python app.py
```

{% endcode %}

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

* Main Page

When you run the `app.py` script, the main page appears first.

<figure><img src="/files/y6PnoLDgYTfiX3E52yoB" alt=""><figcaption><p>main page in 1:N surveillance</p></figcaption></figure>

* Register Person Page

You can enroll user from image.

<figure><img src="/files/bh01mvdhNkCd8Jd6q3qa" alt=""><figcaption><p>user registration page</p></figcaption></figure>

* User List Page

The registered user list is displayed.

<figure><img src="/files/IPBgCzmBOY26gOMvdmbr" alt=""><figcaption><p>user list page</p></figcaption></figure>

* Photo Match Page

You can identify registered users from selected image.

<figure><img src="/files/hy90BGRNotsmsmoLCRWF" alt=""><figcaption><p>photo match page</p></figcaption></figure>

* Video Surveillance Page

You can identify registered users from video stream.

Media file, RTSP stream, Web Camera can be used as video stream.

<figure><img src="/files/RByCitx6pUB5etIn3K6S" alt=""><figcaption><p>select video stream page</p></figcaption></figure>

<figure><img src="/files/5YXWL65097ffXDpQquEq" alt=""><figcaption><p>video surveillance page</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.recognito.vision/face-recognition-sdk/integration-guide/windows/sample-application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
