Spaces:
Runtime error
Runtime error
File size: 826 Bytes
95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da 4a86490 95901da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | from deepface import DeepFace
import gradio as gr
from PIL import Image
import os
# Nombre de la imagen base
BASE_IMAGE = "usuario_base.jpg"
def verificar(imagen):
try:
if not os.path.exists(BASE_IMAGE):
return {"error": "No se encuentra la imagen base."}
# Comparar imágenes
resultado = DeepFace.verify(img1_path=imagen, img2_path=BASE_IMAGE, enforce_detection=True)
return {
"match": resultado["verified"],
"similarity": round(resultado["distance"], 4),
"model": resultado["model"]
}
except Exception as e:
return {"error": str(e)}
# Interfaz Gradio
iface = gr.Interface(
fn=verificar,
inputs=gr.Image(type="filepath"),
outputs="json",
title="GariMindFace – Verificador Facial"
)
iface.launch()
|