Finds faces at an url
Finds all faces on images at the specified URL. Based on FastAPI library for serving HTTP endpoint. It uses dlib library for face detection and alignment. All the detected images are saved to ./images directory, with a separate subdirectory for each URL parsed.
Configuration is in the config.yml file. Here you can configure the dlib model binary used for face landmarks detection, and the final face image file size.
uvicorn --workers 4 main:app
- build Docker image:
docker build -t fast_face_finder .
It will take a while as dlib compiling is a long process.
- run the container:
mkdir $(pwd)/detected_faces
docker run -d --name fast_face_finder -p 80:80 -v $(pwd)/detected_faces:/app/images fast_face_finder
The -v docker argument is optional. It will mount the host directory ./detected_faces/ into /app/images/ in the container, where all faces images will be collected in.
The container exposes port 80, you can make get requests to it, the endpoint name is faces. It accepts url query argument with the url to parse for images.
Url has to be encoded, you can use https://www.urlencoder.org/ for that.
Example (open in browser):
or with wget
wget http://127.0.0.1/faces?url=https%3A%2F%2Fwww.bbc.com%2Fnews%2Fworld-59109186