import gradio as gr import requests from PIL import Image import io import cv2 import numpy as np palmvein_count = 0 def palmvein(frame1, frame2): global palmvein_count palmvein_count = palmvein_count + 1 url = "http://127.0.0.1:8080/palmvein" files = {'file1': open(frame1, 'rb'), 'file2': open(frame2, 'rb')} r = requests.post(url=url, files=files) html = None compare_result = r.json().get('result') compare_similarity = r.json().get('score') html = ("" "" "" "" "" "" "" "" "" "" "" "" "" "
Compare ResultValue
Result{compare_result}
Similarity{compare_similarity}
".format(compare_result=compare_result, compare_similarity=compare_similarity)) return [html] with gr.Blocks() as demo: gr.Markdown( """ # KBY-AI Palm-Vein 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://cap.kby-ai.com """ ) with gr.TabItem("PalmVein Recognition"): gr.Markdown( """ ##### Docker Hub - https://hub.docker.com/r/kbyai/palmvein-recognition ```bash sudo docker pull kbyai/palmvein-recognition:latest sudo docker run -v ./license.txt:/home/openvino/kby-ai-palmvein/license.txt -p 8081:8080 -p 9001:9000 kbyai/palmvein-recognition:latest ``` """ ) with gr.Row(): with gr.Column(): compare_palmvein_input1 = gr.Image(type='filepath') gr.Examples(['palmvein_examples/1.jpg', 'palmvein_examples/3.jpg', 'palmvein_examples/5.jpg', 'palmvein_examples/7.jpg'], inputs=compare_palmvein_input1) compare_palmvein_button = gr.Button("Compare Hand") with gr.Column(): compare_palmvein_input2 = gr.Image(type='filepath') gr.Examples(['palmvein_examples/2.jpg', 'palmvein_examples/4.jpg', 'palmvein_examples/6.jpg', 'palmvein_examples/8.jpg'], inputs=compare_palmvein_input2) with gr.Column(): compare_result_output = gr.HTML(label='Result') compare_palmvein_button.click(palmvein, inputs=[compare_palmvein_input1, compare_palmvein_input2], outputs=[compare_result_output]) gr.HTML('') demo.launch(server_name="0.0.0.0", server_port=7860)