justin2341 commited on
Commit
48b21a3
·
verified ·
1 Parent(s): c5e21cb

Update demo.py

Browse files
Files changed (1) hide show
  1. demo.py +20 -20
demo.py CHANGED
@@ -5,22 +5,22 @@ import io
5
  import cv2
6
  import numpy as np
7
 
8
- palmprint_count = 0
9
 
10
- def compare_palmprint(frame1, frame2):
11
- global palmprint_count
12
 
13
- palmprint_count = palmprint_count + 1
14
 
15
- url = "http://127.0.0.1:8080/compare_palmprint"
16
  files = {'file1': open(frame1, 'rb'), 'file2': open(frame2, 'rb')}
17
 
18
  r = requests.post(url=url, files=files)
19
 
20
  html = None
21
 
22
- compare_result = r.json().get('compare_result')
23
- compare_similarity = r.json().get('compare_similarity')
24
 
25
  html = ("<table>"
26
  "<tr>"
@@ -42,7 +42,7 @@ def compare_palmprint(frame1, frame2):
42
  with gr.Blocks() as demo:
43
  gr.Markdown(
44
  """
45
- # KBY-AI Palm-Print Recognition
46
  We offer SDKs for face recognition, liveness detection(anti-spoofing), ID card recognition and ID document liveness detection.
47
  We also specialize in providing outsourcing services with a variety of technical stacks like AI(Computer Vision/Machine Learning), Mobile apps, and web apps.
48
 
@@ -51,30 +51,30 @@ with gr.Blocks() as demo:
51
  """
52
  )
53
 
54
- with gr.TabItem("Palmprint Recognition"):
55
  gr.Markdown(
56
  """
57
- ##### Docker Hub - https://hub.docker.com/r/kbyai/palmprint-recognition
58
  ```bash
59
- sudo docker pull kbyai/palmprint-recognition:latest
60
- sudo docker run -v ./license.txt:/root/kby-ai-palmprint/license.txt -p 8081:8080 -p 9001:9000 kbyai/palmprint-recognition:latest
61
  ```
62
  """
63
  )
64
  with gr.Row():
65
  with gr.Column():
66
- compare_palmprint_input1 = gr.Image(type='filepath')
67
- gr.Examples(['palmprint_examples/1.jpg', 'palmprint_examples/3.jpg', 'palmprint_examples/5.jpg', 'palmprint_examples/7.jpg'],
68
- inputs=compare_palmprint_input1)
69
- compare_palmprint_button = gr.Button("Compare Hand")
70
  with gr.Column():
71
- compare_palmprint_input2 = gr.Image(type='filepath')
72
- gr.Examples(['palmprint_examples/2.jpg', 'palmprint_examples/4.jpg', 'palmprint_examples/6.jpg', 'palmprint_examples/8.jpg'],
73
- inputs=compare_palmprint_input2)
74
  with gr.Column():
75
  compare_result_output = gr.HTML(label='Result')
76
 
77
- compare_palmprint_button.click(compare_palmprint, inputs=[compare_palmprint_input1, compare_palmprint_input2], outputs=[compare_result_output])
78
  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>')
79
 
80
  demo.launch(server_name="0.0.0.0", server_port=7860)
 
5
  import cv2
6
  import numpy as np
7
 
8
+ palmvein_count = 0
9
 
10
+ def palmvein(frame1, frame2):
11
+ global palmvein_count
12
 
13
+ palmvein_count = palmvein_count + 1
14
 
15
+ url = "http://127.0.0.1:8080/palmvein"
16
  files = {'file1': open(frame1, 'rb'), 'file2': open(frame2, 'rb')}
17
 
18
  r = requests.post(url=url, files=files)
19
 
20
  html = None
21
 
22
+ compare_result = r.json().get('result')
23
+ compare_similarity = r.json().get('score')
24
 
25
  html = ("<table>"
26
  "<tr>"
 
42
  with gr.Blocks() as demo:
43
  gr.Markdown(
44
  """
45
+ # KBY-AI Palm-Vein Recognition
46
  We offer SDKs for face recognition, liveness detection(anti-spoofing), ID card recognition and ID document liveness detection.
47
  We also specialize in providing outsourcing services with a variety of technical stacks like AI(Computer Vision/Machine Learning), Mobile apps, and web apps.
48
 
 
51
  """
52
  )
53
 
54
+ with gr.TabItem("PalmVein Recognition"):
55
  gr.Markdown(
56
  """
57
+ ##### Docker Hub - https://hub.docker.com/r/kbyai/palmvein-recognition
58
  ```bash
59
+ sudo docker pull kbyai/palmvein-recognition:latest
60
+ sudo docker run -v ./license.txt:/home/openvino/kby-ai-palmvein/license.txt -p 8081:8080 -p 9001:9000 kbyai/palmvein-recognition:latest
61
  ```
62
  """
63
  )
64
  with gr.Row():
65
  with gr.Column():
66
+ compare_palmvein_input1 = gr.Image(type='filepath')
67
+ gr.Examples(['palmvein_examples/1.jpg', 'palmvein_examples/3.jpg', 'palmvein_examples/5.jpg', 'palmvein_examples/7.jpg'],
68
+ inputs=compare_palmvein_input1)
69
+ compare_palmvein_button = gr.Button("Compare Hand")
70
  with gr.Column():
71
+ compare_palmvein_input2 = gr.Image(type='filepath')
72
+ gr.Examples(['palmvein_examples/2.jpg', 'palmvein_examples/4.jpg', 'palmvein_examples/6.jpg', 'palmvein_examples/8.jpg'],
73
+ inputs=compare_palmvein_input2)
74
  with gr.Column():
75
  compare_result_output = gr.HTML(label='Result')
76
 
77
+ compare_palmvein_button.click(palmvein, inputs=[compare_palmvein_input1, compare_palmvein_input2], outputs=[compare_result_output])
78
  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>')
79
 
80
  demo.launch(server_name="0.0.0.0", server_port=7860)