Delete app.py
Browse files
app.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
-
import requests
|
| 4 |
-
import json
|
| 5 |
-
|
| 6 |
-
def check_id_liveness(frame):
|
| 7 |
-
url = "https://idlive.miniai.live/api/check_id_liveness"
|
| 8 |
-
files = {'image': open(frame, 'rb')}
|
| 9 |
-
try:
|
| 10 |
-
r = requests.post(url=url, files=files)
|
| 11 |
-
r.raise_for_status()
|
| 12 |
-
return json.dumps(r.json(), indent=2)
|
| 13 |
-
except requests.exceptions.RequestException as e:
|
| 14 |
-
return str(e)
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# APP Interface
|
| 18 |
-
with gr.Blocks() as MiniAIdemo:
|
| 19 |
-
gr.Markdown(
|
| 20 |
-
"""
|
| 21 |
-
<a href="https://miniai.live" style="display: flex; align-items: center;">
|
| 22 |
-
<img src="https://miniai.live/wp-content/uploads/2024/02/logo_name-1-768x426-1.png" style="width: 18%; margin-right: 15px;"/>
|
| 23 |
-
<div>
|
| 24 |
-
<p style="font-size: 40px; font-weight: bold; margin-right: 20px;">ID Document Liveness Detection SDK Demo</p>
|
| 25 |
-
</div>
|
| 26 |
-
</a>
|
| 27 |
-
<br/>
|
| 28 |
-
<div style="display: flex; justify-content: center; align-items: center;">
|
| 29 |
-
<table style="text-align: center;">
|
| 30 |
-
<tr>
|
| 31 |
-
<td style="text-align: center; vertical-align: middle;"><a href="https://github.com/MiniAiLive"><img src="https://miniai.live/wp-content/uploads/2024/10/new_git-1-300x67.png" style="height: 50px; margin-right: 5px;" title="GITHUB"/></a></td>
|
| 32 |
-
<td style="text-align: center; vertical-align: middle;"><a href="https://huggingface.co/MiniAiLive"><img src="https://miniai.live/wp-content/uploads/2024/10/new_hugging-1-300x67.png" style="height: 50px; margin-right: 5px;" title="HuggingFace"/></a></td>
|
| 33 |
-
<td style="text-align: center; vertical-align: middle;"><a href="https://demo.miniai.live"><img src="https://miniai.live/wp-content/uploads/2024/10/new_gradio-300x67.png" style="height: 50px; margin-right: 5px;" title="Gradio"/></a></td>
|
| 34 |
-
</tr>
|
| 35 |
-
<tr>
|
| 36 |
-
<td style="text-align: center; vertical-align: middle;"><a href="https://docs.miniai.live/"><img src="https://miniai.live/wp-content/uploads/2024/10/a-300x70.png" style="height: 50px; margin-right: 5px;" title="Documentation"/></a></td>
|
| 37 |
-
<td style="text-align: center; vertical-align: middle;"><a href="https://www.youtube.com/@miniailive"><img src="https://miniai.live/wp-content/uploads/2024/10/Untitled-1-300x70.png" style="height: 50px; margin-right: 5px;" title="Youtube"/></a></td>
|
| 38 |
-
<td style="text-align: center; vertical-align: middle;"><a href="https://play.google.com/store/apps/dev?id=5831076207730531667"><img src="https://miniai.live/wp-content/uploads/2024/10/googleplay-300x62.png" style="height: 50px; margin-right: 5px;" title="Google Play"/></a></td>
|
| 39 |
-
</tr>
|
| 40 |
-
</table>
|
| 41 |
-
</div>
|
| 42 |
-
<br/>
|
| 43 |
-
"""
|
| 44 |
-
)
|
| 45 |
-
with gr.Tabs():
|
| 46 |
-
with gr.TabItem("ID Document Liveness Detection"):
|
| 47 |
-
with gr.Row():
|
| 48 |
-
with gr.Column():
|
| 49 |
-
im_idlive_input = gr.Image(type='filepath', height=300)
|
| 50 |
-
gr.Examples(
|
| 51 |
-
[
|
| 52 |
-
os.path.join(os.path.dirname(__file__), "images/demo1.jpg"),
|
| 53 |
-
],
|
| 54 |
-
inputs=im_idlive_input
|
| 55 |
-
)
|
| 56 |
-
btn_f_idlive = gr.Button("Analysis Document", variant='primary')
|
| 57 |
-
with gr.Column():
|
| 58 |
-
txt_idlive_output = gr.Textbox(label="API Response (JSON)")
|
| 59 |
-
btn_f_idlive.click(check_id_liveness, inputs=im_idlive_input, outputs=txt_idlive_output)
|
| 60 |
-
gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiniAiLive%2FID-Document-Liveness-Demo"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiniAiLive%2FID-Document-Liveness-Demo&label=VISITORS&labelColor=%2337d67a&countColor=%23ff8a65&style=plastic&labelStyle=none" /></a>')
|
| 61 |
-
|
| 62 |
-
if __name__ == "__main__":
|
| 63 |
-
MiniAIdemo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|