{ "cells": [ { "cell_type": "markdown", "id": "dc629106", "metadata": {}, "source": [ "# Face verification prototype: run in Google Colab\n", "\n", "IE University · AI/ML group project · *How lighting, occlusion and ageing affect face verification*\n", "\n", "**How to use it (about 3 minutes):**\n", "1. Click **Runtime → Run all** (accept the \"not authored by Google\" warning).\n", "2. Wait for the last cell to print a link like `https://xxxx.gradio.live`.\n", "3. Open the link, upload two face photos, pick a condition and a strength.\n", "\n", "The link works while this Colab session is open (up to about 72 hours). Close the tab or restart to stop it. Anyone can run this notebook again for a new link.\n", "\n", "*Research prototype, not an identity-check system. Uploaded photos are used only for the comparison and are deleted from the server within an hour. Please only upload photos you have the right to use.*" ] }, { "cell_type": "code", "execution_count": null, "id": "a5e8c917", "metadata": {}, "outputs": [], "source": [ "# 1. Install the exact versions the model was saved with (about 1 minute)\n", "!pip install -q scikit-learn==1.9.1 gradio==6.31.0\n", "# The face detector pins old library versions, so it is installed without them\n", "!pip install -q --no-deps facenet-pytorch==2.6.0" ] }, { "cell_type": "code", "execution_count": null, "id": "917c7c2a", "metadata": {}, "outputs": [], "source": [ "# 2. Download the app code and trained model (no dataset images)\n", "import os, sys\n", "from huggingface_hub import snapshot_download\n", "\n", "# local_dir = real files (the code finds its model relative to its own location)\n", "app_dir = snapshot_download(\"Jadebks/face-verification-prototype\", local_dir=\"face-verification-app\")\n", "os.chdir(app_dir)\n", "sys.path.insert(0, app_dir)\n", "print(\"Downloaded to\", app_dir)" ] }, { "cell_type": "code", "execution_count": null, "id": "3a069bf0", "metadata": {}, "outputs": [], "source": [ "# 3. Start the app and print the public link\n", "import app\n", "demo = app.build()\n", "demo.launch(share=True)" ] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }