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()