File size: 2,942 Bytes
3b918d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import gradio as gr
import requests
from PIL import Image
import io
import cv2
import numpy as np

palmprint_count = 0

def compare_palmprint(frame1, frame2):
    global palmprint_count
    
    palmprint_count = palmprint_count + 1

    url = "http://127.0.0.1:8080/compare_palmprint"
    files = {'file1': open(frame1, 'rb'), 'file2': open(frame2, 'rb')}

    r = requests.post(url=url, files=files)

    html = None

    compare_result = r.json().get('compare_result')
    compare_similarity = r.json().get('compare_similarity')

    html = ("<table>"
                "<tr>"
                    "<th>Compare Result</th>"
                    "<th>Value</th>"
                "</tr>"
                "<tr>"
                    "<td>Result</td>"
                    "<td>{compare_result}</td>"
                "</tr>"
                "<tr>"
                    "<td>Similarity</td>"
                    "<td>{compare_similarity}</td>"
                "</tr>"
                "</table>".format(compare_result=compare_result, compare_similarity=compare_similarity))

    return [html]

with gr.Blocks() as demo:
    gr.Markdown(
        """
    # KBY-AI License Plate Recognition 
    We offer SDKs for face recognition, liveness detection(anti-spoofing), ID card recognition and ID document liveness detection. 
    We also specialize in providing outsourcing services with a variety of technical stacks like AI(Computer Vision/Machine Learning), mobile apps, and web apps.
    
    ##### KYC Verification Demo - https://github.com/kby-ai/KYC-Verification-Demo-Android
    ##### ID Capture Web Demo - https://id-document-recognition-react-alpha.vercel.app
    """
    )

    with gr.TabItem("License Plate Recognition"):
        gr.Markdown(
            """
        ##### Docker Hub - https://hub.docker.com/r/kbyai/license-plate-recognition
        ```bash
        sudo docker pull kbyai/license-plate-recognition:latest
        sudo docker run -v ./license.txt:/home/openvino/kby-ai-alpr/license.txt -p 8081:8080 -p 9001:9000 kbyai/license-plate-recognition:latest
        ```
        """
        )
        with gr.Row():
            with gr.Column():
                alpr_image_input = gr.Image(type='filepath', height=300)
                gr.Examples(['alpr_examples/test1.jpg', 'alpr_examples/test2.jpg', 'alpr_examples/test3.jpg'], 
                            inputs=alpr_image_input)
                alpr_confirmation_button = gr.Button("Confirm")
            with gr.Column():
                with gr.Column():
                alpr_output = gr.Image(type="numpy")

        alpr_confirmation_button.click(alpr, inputs=alpr_image_input, outputs=alpr_output)
    gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fweb.kby-ai.com%2F"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fweb.kby-ai.com%2F&label=VISITORS&countColor=%23263759" /></a>')

demo.launch(server_name="0.0.0.0", server_port=7860)