Skip to content

PradyumnaKrishna/face-authentication

Repository files navigation

Face Authentication

Face Authentication is an API uses Azure Cognitive Services to identify or verify same persons. This API is implemented using FastAPI.

A Web Client of Face Authentication implemented using Vue.js and JavaScript contains login and registration features.

📖 About

Face Authentication provides a variety of use cases. The primary use case is to verify same person using facial recognition or camera. API docs are present at /docs endpoint of the server.

Azure Cognitive Services

This API requires Azure Cognitive Services or Azure Face API for the face operations in the image provided. app/core/face_api.py file contains all operations used by this API such as detect, verify, createPersonGroup etc.

Azure Cognitive Services credentials are required and there is a free tier available on azure. After creating the services, create a personGroup and pass these three credentials (FACE_API_ENDPOINT, FACE_API_KEY, FACE_API_GROUP) to the server using environment variables.

export FACE_API_ENDPOINT=    # API Endpoint provided by Azure
export FACE_API_KEY=         # API Key provided by Azure
export FACE_API_GROUP=       # Created personGroup ID

To read more about Face API, refer to the docs.

⭐ Getting Started

This codebase can be run using one of three different approaches:

  1. Docker
  2. Python

0. Prerequisites

  • Azure Cognitive Services credentials are required.

1. Docker

This approach runs an official published image. This approach is not intended for development. It works on Windows, Mac, and Linux.

# Pull the image from DockerHub
docker pull ipradyumna/face-auth:latest

# Start a container pass required env variables, exposed on port 80 of the host machine
docker run -d -p 8000:80 -e FACE_API_ENDPOINT=<endpoint> -e FACE_API_KEY=<key> -e FACE_API_GROUP=<group> ipradyumna/face-auth:latest

2. Python

*Note for windows, you are required to install WSL2 and setup the your ide.

Using make, install and setup the environment:

make environment

Run the server using

make start

Debugging

For local debugging, run it and once the server is up, you can easily hit your breakpoints.

If the code fails to run, make sure your Python interpreter is set to use your poetry environment.

📝 Documentation

FastApi defaultly has API documentation built in.

🤝 Contributing

This project encourages community contributions for development, testing, documentation, code review, and performance analysis, etc.

📃 License

This repository is licensed under the MIT License