import gradio as gr
import os
import requests
import json
def check_id_liveness(frame):
url = "https://idlive.miniai.live/api/check_id_liveness"
files = {'image': open(frame, 'rb')}
try:
r = requests.post(url=url, files=files)
r.raise_for_status()
return json.dumps(r.json(), indent=2)
except requests.exceptions.RequestException as e:
return str(e)
# APP Interface
with gr.Blocks() as MiniAIdemo:
gr.Markdown(
"""
ID Document Liveness Detection SDK Demo