import gradio as gr from yolo.yoloFace import YOLO_FACE from vgg.vgg_face import MODEL_FACE from database.retriever import BruteForceStore import cv2 # Initialize the database DB = BruteForceStore() def pipeline(img): images = YOLO_FACE(img) for patch in images: embeddings = MODEL_FACE(patch) if DB(embeddings): return "Welcome!" return "Unauthorised" # Define a Gradio interface def process_image(image): if image is None: return "Please upload an image." result = pipeline(image) return result # Gradio App with gr.Blocks() as demo: gr.Markdown("""

Face Verification App

Upload your photo and let the app verify your identity!

""") with gr.Row(): with gr.Column(scale=1): image_input = gr.Image(type="numpy", label="Upload Your Image") with gr.Column(scale=1): output_text = gr.Textbox(label="Verification Result", interactive=False) with gr.Row(): submit_button = gr.Button("Verify") submit_button.click(process_image, inputs=[image_input], outputs=[output_text]) if __name__ == "__main__": demo.launch()