mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 03:55:21 +00:00
Merge pull request #1246 from serengil/feat-task-0206-cosmetic-changes-for-docker
Feat task 0206 cosmetic changes for docker
This commit is contained in:
commit
188e15c177
@ -315,11 +315,11 @@ cd scripts
|
||||
|
||||
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/deepface-api.jpg" width="90%" height="90%"></p>
|
||||
|
||||
Face recognition, facial attribute analysis and vector representation functions are covered in the API. You are expected to call these functions as http post methods. Default service endpoints will be `http://localhost:5000/verify` for face recognition, `http://localhost:5000/analyze` for facial attribute analysis, and `http://localhost:5000/represent` for vector representation. You can pass input images as exact image paths on your environment, base64 encoded strings or images on web. [Here](https://github.com/serengil/deepface/tree/master/deepface/api/postman), you can find a postman project to find out how these methods should be called.
|
||||
Face recognition, facial attribute analysis and vector representation functions are covered in the API. You are expected to call these functions as http post methods. Default service endpoints will be `http://localhost:5005/verify` for face recognition, `http://localhost:5005/analyze` for facial attribute analysis, and `http://localhost:5005/represent` for vector representation. You can pass input images as exact image paths on your environment, base64 encoded strings or images on web. [Here](https://github.com/serengil/deepface/tree/master/deepface/api/postman), you can find a postman project to find out how these methods should be called.
|
||||
|
||||
**Dockerized Service** - [`Demo`](https://youtu.be/9Tk9lRQareA)
|
||||
|
||||
You can deploy the deepface api on a kubernetes cluster with docker. The following [shell script](https://github.com/serengil/deepface/blob/master/scripts/dockerize.sh) will serve deepface on `localhost:5000`. You need to re-configure the [Dockerfile](https://github.com/serengil/deepface/blob/master/Dockerfile) if you want to change the port. Then, even if you do not have a development environment, you will be able to consume deepface services such as verify and analyze. You can also access the inside of the docker image to run deepface related commands. Please follow the instructions in the [shell script](https://github.com/serengil/deepface/blob/master/scripts/dockerize.sh).
|
||||
You can deploy the deepface api on a kubernetes cluster with docker. The following [shell script](https://github.com/serengil/deepface/blob/master/scripts/dockerize.sh) will serve deepface on `localhost:5005`. You may need to re-configure the [Dockerfile](https://github.com/serengil/deepface/blob/master/Dockerfile) if you want to apply some customization. Then, even if you do not have a development environment, you will be able to consume deepface services such as verify and analyze. You can also access the inside of the docker image to run deepface related commands. Please follow the instructions in the [shell script](https://github.com/serengil/deepface/blob/master/scripts/dockerize.sh).
|
||||
|
||||
```shell
|
||||
cd scripts
|
||||
|
@ -1,8 +1,14 @@
|
||||
# 3rd parth dependencies
|
||||
from flask import Flask
|
||||
from deepface import DeepFace
|
||||
from deepface.api.src.modules.core.routes import blueprint
|
||||
from deepface.commons import logger as log
|
||||
|
||||
logger = log.get_singletonish_logger()
|
||||
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
app.register_blueprint(blueprint)
|
||||
logger.info(f"Welcome to DeepFace API v{DeepFace.__version__}!")
|
||||
return app
|
||||
|
@ -1,4 +1,5 @@
|
||||
from flask import Blueprint, request
|
||||
from deepface import DeepFace
|
||||
from deepface.api.src.modules.core import service
|
||||
from deepface.commons import logger as log
|
||||
|
||||
@ -9,7 +10,7 @@ blueprint = Blueprint("routes", __name__)
|
||||
|
||||
@blueprint.route("/")
|
||||
def home():
|
||||
return "<h1>Welcome to DeepFace API!</h1>"
|
||||
return f"<h1>Welcome to DeepFace API v{DeepFace.__version__}!</h1>"
|
||||
|
||||
|
||||
@blueprint.route("/represent", methods=["POST"])
|
||||
|
@ -17,7 +17,8 @@ docker build -t deepface .
|
||||
# docker cp ~/.deepface/weights/. <CONTAINER_ID>:/root/.deepface/weights/
|
||||
|
||||
# run image
|
||||
docker run --net="host" deepface
|
||||
# docker run --net="host" deepface
|
||||
docker run -p 5005:5000 deepface
|
||||
|
||||
# to access the inside of docker image when it is in running status
|
||||
# docker exec -it <CONTAINER_ID> /bin/sh
|
||||
|
@ -5,4 +5,4 @@ cd ../deepface/api/src
|
||||
# python api.py
|
||||
|
||||
# run the service with gunicorn - for prod purposes
|
||||
gunicorn --workers=1 --timeout=3600 --bind=0.0.0.0:5000 "app:create_app()"
|
||||
gunicorn --workers=1 --timeout=3600 --bind=0.0.0.0:5005 "app:create_app()"
|
Loading…
x
Reference in New Issue
Block a user