Skip to content

Example of how to use Face API with Azure Functions | Python

Notifications You must be signed in to change notification settings

pieaisv/faceapi-azure-functions-python

Repository files navigation

Example of how to use Face API with Azure Functions | Python

Steps for run project

  1. Azure Functions Core Tools

    Benefits

    • Create a function from a trigger and language-specific template.
    • Run the function locally.
    • Publish the project to Azure.
  2. Create virtual enviroment

virtualenv venv
  1. Activate
source ./venv/bin/activate
  1. Install dependencies
pip3 install -r requirements.txt
  1. Run server locally
func host start

Endpoints

[GET] http://localhost:7071/api/draw

  • Params
    • single: Image with a face
    • multiple: Image with a face or multiple
http://localhost:7071/api/draw?single=https://i.ibb.co/yVxyc09/ibai.jpg&multiple=https://i.ibb.co/2jG2VLm/ibai-friends.jpg

Single

single

Multiple

multiple

Output

output

[POST] http://localhost:7071/api/similar

  • Body
    • single: Image with a face
    • multiple: Image with a face or multiple
{
  "single": "https://i.ibb.co/yVxyc09/ibai.jpg",
  "multiple": "https://i.ibb.co/2jG2VLm/ibai-friends.jpg"
}

Test with CURL

curl -d '{"single": "https://i.ibb.co/yVxyc09/ibai.jpg","multiple": "https://i.ibb.co/2jG2VLm/ibai-friends.jpg"}' -H "Content-Type: application/json" -X POST http://localhost:7071/api/similar

Output

{
  "similar": true,
  "message": "Similar Faces",
  "facesNumber": {
    "single": 1,
    "multiple": 3
  },
  "drawUrl": "http://localhost:7071/api/draw?single=https://i.ibb.co/yVxyc09/ibai.jpg&multiple=https://i.ibb.co/2jG2VLm/ibai-friends.jpg"
}

If not similar

{
  "similar": false,
  "message": "No similar faces found image.jpg",
  "facesNumber": {
    "single": 1,
    "multiple": 1
  },
  "drawUrl": ""
}

About

Example of how to use Face API with Azure Functions | Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published