Spaces:
Runtime error
Runtime error
Commit
·
b82c88d
1
Parent(s):
8da709d
Initial files
Browse files- .gitattributes +29 -32
- README.md +6 -5
- app.py +110 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,32 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.
|
| 25 |
-
*.
|
| 26 |
-
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.
|
| 30 |
-
*.
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
*.npy filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 6 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.caffemodel filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
images/6.jpg filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
images/rec_2.jpg filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
images/rec_4.jpg filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
images/rec_5.jpg filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
images/rec_8.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
images/11.jpg filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
images/4.jpg filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
images/5.jpg filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
images/mrz_4.jpg filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
images/10.jpg filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
images/12.jpg filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
images/mrz_1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
images/rec_3.jpg filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
images/rec_7.jpg filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
images/rec_1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
images/rec_6.jpg filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
images/2.png filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
images/3.png filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
images/4.png filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
images/7.png filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
images/8.png filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
images/9.png filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
images/mrz_2.png filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
images/1.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Liveness
|
| 3 |
emoji: 📈
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 4.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Liveness-Detection-SDK
|
| 3 |
emoji: 📈
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.43.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import os
|
| 3 |
+
import io
|
| 4 |
+
import base64
|
| 5 |
+
import json
|
| 6 |
+
import gradio as gr
|
| 7 |
+
import requests
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def face_recognition_on_file(file1, file2):
|
| 11 |
+
url = "http://93.127.215.33:8080/face_recognition"
|
| 12 |
+
try:
|
| 13 |
+
files = {'file1': open(file1, 'rb'), 'file2': open(file2, 'rb')}
|
| 14 |
+
|
| 15 |
+
r = requests.post(url=url, files=files)
|
| 16 |
+
r.raise_for_status() # Raise an exception for bad status codes
|
| 17 |
+
except requests.RequestException as e:
|
| 18 |
+
raise gr.Error(f"Error occurred: {str(e)}")
|
| 19 |
+
except IOError:
|
| 20 |
+
raise gr.Error("Please select valid image files!")
|
| 21 |
+
|
| 22 |
+
try:
|
| 23 |
+
response = r.json()
|
| 24 |
+
print(response)
|
| 25 |
+
return response
|
| 26 |
+
except json.JSONDecodeError:
|
| 27 |
+
raise gr.Error("Invalid response from server")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def liveness_detection_on_file(file):
|
| 31 |
+
url = "http://93.127.215.33:8080/check_liveness"
|
| 32 |
+
try:
|
| 33 |
+
files = {'file': open(file, 'rb')}
|
| 34 |
+
r = requests.post(url=url, files=files)
|
| 35 |
+
r.raise_for_status() # Raise an exception for bad status codes
|
| 36 |
+
except requests.RequestException as e:
|
| 37 |
+
raise gr.Error(f"Error occurred: {str(e)}")
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
response = r.json()
|
| 41 |
+
print(response)
|
| 42 |
+
return response
|
| 43 |
+
except json.JSONDecodeError:
|
| 44 |
+
raise gr.Error("Invalid response from server")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
with gr.Blocks() as demo:
|
| 48 |
+
gr.Markdown(
|
| 49 |
+
"""
|
| 50 |
+
<a href="https://faceplugin.com" style="display: flex; align-items: center;">
|
| 51 |
+
<img src="https://faceplugin.com/wp-content/uploads/2024/02/Square-png-file_2-1.png" style="width: 8%; margin-right: 15px;"/>
|
| 52 |
+
<div>
|
| 53 |
+
<p style="font-size: 24px; font-weight: bold; margin: 0;">FacePlugIn Ltd</p>
|
| 54 |
+
</div>
|
| 55 |
+
</a>
|
| 56 |
+
|
| 57 |
+
## Company Overview
|
| 58 |
+
|
| 59 |
+
FacePlugin Ltd is a pioneering company at the forefront of innovative solutions in the realm of facial recognition technology and computer vision. Established with a commitment to revolutionize security and authentication processes, FacePlugin specializes in cutting-edge solutions including face liveness detection, ID card recognition, face recognition, biometric authentication, and e-KYC (Electronic Know Your Customer) solutions.
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
<h2>List of our Products</h2>
|
| 63 |
+
|
| 64 |
+
* **[FaceRecognition-LivenessDetection-Android](https://github.com/Faceplugin-ltd/FaceRecognition-LivenessDetection-Android)**
|
| 65 |
+
* **[FaceRecognition-LivenessDetection-iOS](https://github.com/Faceplugin-ltd/FaceRecognition-LivenessDetection-iOS)**
|
| 66 |
+
* **[FaceRecognition-LivenessDetection-Javascript](https://github.com/Faceplugin-ltd/FaceRecognition-LivenessDetection-Javascript)**
|
| 67 |
+
* **[FaceLivenessDetection-Docker](https://github.com/Faceplugin-ltd/FaceLivenessDetection-Docker)**
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
## Contact
|
| 71 |
+
<div style="display: flex; align-items: center;">
|
| 72 |
+
<a target="_blank" href="mailto:info@faceplugin.com"><img src="https://img.shields.io/badge/email-info@faceplugin.com-blue.svg?logo=gmail " alt="faceplugin.com"></a>
|
| 73 |
+
<a target="_blank" href="https://t.me/faceplugin"><img src="https://img.shields.io/badge/telegram-@faceplugin-blue.svg?logo=telegram " alt="faceplugin.com"></a>
|
| 74 |
+
<a target="_blank" href="https://wa.me/+14422295661"><img src="https://img.shields.io/badge/whatsapp-faceplugin-blue.svg?logo=whatsapp " alt="faceplugin.com">
|
| 75 |
+
</div>
|
| 76 |
+
"""
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
with gr.TabItem("Face Recognition"):
|
| 80 |
+
with gr.Row():
|
| 81 |
+
with gr.Column():
|
| 82 |
+
first_input = gr.Image(type='filepath')
|
| 83 |
+
gr.Examples(['images/rec_7.jpg', 'images/rec_1.jpg', 'images/9.png', 'images/rec_3.jpg'],
|
| 84 |
+
inputs=first_input)
|
| 85 |
+
start_button = gr.Button("Run")
|
| 86 |
+
with gr.Column():
|
| 87 |
+
second_input = gr.Image(type='filepath')
|
| 88 |
+
gr.Examples(['images/rec_8.jpg', 'images/rec_2.jpg', 'images/10.jpg', 'images/rec_4.jpg'],
|
| 89 |
+
inputs=second_input)
|
| 90 |
+
|
| 91 |
+
with gr.Column():
|
| 92 |
+
app_output = [gr.JSON()]
|
| 93 |
+
|
| 94 |
+
start_button.click(face_recognition_on_file, inputs=[first_input, second_input], outputs=app_output)
|
| 95 |
+
with gr.TabItem("Face Liveness Detection"):
|
| 96 |
+
with gr.Row():
|
| 97 |
+
with gr.Column():
|
| 98 |
+
app_input = gr.Image(type='filepath')
|
| 99 |
+
gr.Examples(['images/4.jpg', 'images/1.png', 'images/2.png', 'images/3.png'],
|
| 100 |
+
inputs=app_input)
|
| 101 |
+
start_button = gr.Button("Run")
|
| 102 |
+
with gr.Column():
|
| 103 |
+
app_output = [gr.JSON()]
|
| 104 |
+
|
| 105 |
+
start_button.click(liveness_detection_on_file, inputs=app_input, outputs=app_output)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFacePlugin-Ltd%2FFacePlugin-Face-Recognition-SDK"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFacePlugin-Ltd%2FFacePlugin-Face-Recognition-SDK&labelColor=%23697689&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
|
| 109 |
+
|
| 110 |
+
demo.queue().launch(share=True)
|