A simple face_recgnition webservice api with flask
Clone the repo and install requirements
$ pip install -r requirements.txt
Run the wsgi.py file to start server
$ python wsgi.py
No server will be started on port 9999
- To simply get and recognize faces in one image
$ curl -F '[email protected]' http://localhost:9999/recognize
If one or more faces were found, we get a json response (name and base64 image)
[
{
"name" : "Diams",
"string_img" : "iVBORw0KGgoAAAANSUhEUgAAAGsAAABrCAIAAAD/3etbAAA5WElEQVR4nHW9244kSZIldo6IqrlHXqq..."
}
]
- To simply save a known face
$ curl -H "Content-Type:application/json" -d "[{\"name\" : \"Diams\", string_img : \"iVBORw0KGgoAAAANSUhEUgAAAGsAAABrCAIAAAD/3etbAAA5WElEQVR4nHW9244kSZIldo6IqrlHXqq...\"}]
if there is no error the answer will be
{
"done": true
}
- To simply get all known faces
$ curl http://localhost:9999/get_all_faces
the response return all saved faces
[
{
"name" : "Voanjo",
"string_img" : "iVBORw0KGgoAAAANSUhEUgAAAGsAAABrCAIAAAD/3etbAAA5WElEQVR4nHW9244kSZIldo6IqrlHXsdxqq..."
},
{
"name" : "Ursulla",
"string_img" : "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAA210lEQVR4nH29TY9kyZEtdo6Z3xuZ9dEfJJuc..."
},
{
"name" : "Safdj",
"string_img" : "iVBORw0KGgoAAAANSUhEUgAAAGwAAABrCAIAAAAdAfAiAABAeUlEQVR4nHX9Xa8tW3IdiI0RMWdmrrX2Pver..."
}
]