justin2341 commited on
Commit
01520ed
·
verified ·
1 Parent(s): 087a1f7

Update demo.py

Browse files
Files changed (1) hide show
  1. demo.py +10 -38
demo.py CHANGED
@@ -122,44 +122,16 @@ def check_liveness(frame):
122
  return [faces, html]
123
 
124
  with gr.Blocks() as demo:
125
- gr.Markdown(
126
- """
127
- # KBY-AI - Face Liveness Detecion
128
- We offer SDKs for face recognition, liveness detection(anti-spoofing) and ID card recognition.
129
-
130
- <h4 style="display: flex; align-items: center;">
131
- ID Document Liveness Detection - Linux - <a href="https://web.kby-ai.com">https://web.kby-ai.com</a>
132
- <span>
133
- <img src="https://github.com/kby-ai/.github/assets/125717930/bcf351c5-8b7a-496e-a8f9-c236eb8ad59e" style="margin: 4px; width: 36px; height: 20px">
134
- </span>
135
- </h4>
136
 
137
- ##### KYC Verification Demo - https://github.com/kby-ai/KYC-Verification-Demo-Android
138
- ##### ID Capture Web Demo - https://id-document-recognition-react-alpha.vercel.app
139
- ##### Documentation - Help Center - https://docs.kby-ai.com
140
- """
141
- )
142
- with gr.TabItem("Face Liveness Detection"):
143
- gr.Markdown(
144
- """
145
- ##### Docker Hub - https://hub.docker.com/r/kbyai/face-liveness-detection
146
- ```bash
147
- sudo docker pull kbyai/face-liveness-detection:latest
148
- sudo docker run -e LICENSE="xxxxx" -p 8080:8080 -p 9000:9000 kbyai/face-liveness-detection:latest
149
- ```
150
- """
151
- )
152
- with gr.Row():
153
- with gr.Column():
154
- live_image_input = gr.Image(type='filepath')
155
- gr.Examples(['live_examples/1.jpg', 'live_examples/2.jpg', 'live_examples/3.jpg', 'live_examples/4.jpg'],
156
- inputs=live_image_input)
157
- check_liveness_button = gr.Button("Check Liveness")
158
- with gr.Column():
159
- liveness_face_output = gr.Image(type="pil").style(height=150)
160
- livness_result_output = gr.HTML()
161
-
162
- check_liveness_button.click(check_liveness, inputs=live_image_input, outputs=[liveness_face_output, livness_result_output])
163
- gr.HTML('<a href="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fkby-ai%2FFaceLivenessDetection&countColor=%23263759"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fkby-ai%2FFaceLivenessDetection&countColor=%23263759&label=VISITORS&countColor=%23263759" /></a>')
164
 
165
  demo.launch(server_name="0.0.0.0", server_port=7860)
 
122
  return [faces, html]
123
 
124
  with gr.Blocks() as demo:
125
+ with gr.Row():
126
+ with gr.Column():
127
+ live_image_input = gr.Image(type='filepath')
128
+ gr.Examples(['live_examples/1.jpg', 'live_examples/2.jpg', 'live_examples/3.jpg', 'live_examples/4.jpg'],
129
+ inputs=live_image_input)
130
+ check_liveness_button = gr.Button("Check Liveness")
131
+ with gr.Column():
132
+ liveness_face_output = gr.Image(type="pil").style(height=150)
133
+ livness_result_output = gr.HTML()
 
 
134
 
135
+ check_liveness_button.click(check_liveness, inputs=live_image_input, outputs=[liveness_face_output, livness_result_output])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
  demo.launch(server_name="0.0.0.0", server_port=7860)