mirror of
https://github.com/serengil/deepface.git
synced 2025-06-06 11:35:21 +00:00
put api in deepface folder to make it testable
This commit is contained in:
parent
1ca17d7ada
commit
86d424b8ac
@ -19,11 +19,8 @@ RUN apt-get install ffmpeg libsm6 libxext6 -y
|
||||
# -----------------------------------
|
||||
# Copy required files from repo into image
|
||||
COPY ./deepface /app/deepface
|
||||
COPY ./api/src/app.py /app/
|
||||
COPY ./api/src/api.py /app/
|
||||
COPY ./api/src/routes.py /app/
|
||||
COPY ./api/src/service.py /app/
|
||||
COPY ./requirements.txt /app/
|
||||
COPY ./package_info.json /app/package_info.json
|
||||
COPY ./setup.py /app/
|
||||
COPY ./README.md /app/
|
||||
|
||||
@ -50,5 +47,6 @@ ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# -----------------------------------
|
||||
# run the app (re-configure port if necessary)
|
||||
WORKDIR /app/deepface/api/src
|
||||
EXPOSE 5000
|
||||
CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"]
|
||||
|
@ -280,7 +280,7 @@ user
|
||||
|
||||
**API** - [`Demo`](https://youtu.be/HeKCQ6U9XmI)
|
||||
|
||||
DeepFace serves an API as well. You can clone [`/api`](https://github.com/serengil/deepface/tree/master/api) folder and run the api via gunicorn server. This will get a rest service up. In this way, you can call deepface from an external system such as mobile app or web.
|
||||
DeepFace serves an API as well. You can clone deepface source code and run the api via gunicorn server with the following command. This will get a rest service up. In this way, you can call deepface from an external system such as mobile app or web.
|
||||
|
||||
```shell
|
||||
cd scripts
|
||||
|
@ -1,6 +1,6 @@
|
||||
# 3rd parth dependencies
|
||||
from flask import Flask
|
||||
from modules.core.routes import blueprint
|
||||
from deepface.api.src.modules.core.routes import blueprint
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
@ -1,5 +1,5 @@
|
||||
from flask import Blueprint, request
|
||||
from modules.core import service
|
||||
from deepface.api.src.modules.core import service
|
||||
from deepface.commons.logger import Logger
|
||||
|
||||
logger = Logger(module="api/src/routes.py")
|
@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
cd ../api/src
|
||||
cd ../deepface/api/src
|
||||
gunicorn --workers=1 --timeout=3600 --bind=0.0.0.0:5000 "app:create_app()"
|
@ -1,12 +1,7 @@
|
||||
import sys
|
||||
import unittest
|
||||
from deepface.commons import constant
|
||||
from deepface.commons.logger import Logger
|
||||
from deepface.api.src.app import create_app
|
||||
|
||||
# api is not available under deepface import
|
||||
sys.path.insert(1, f"{constant.ROOT_DIR}/api/src")
|
||||
# pylint: disable=wrong-import-order, wrong-import-position
|
||||
from app import create_app
|
||||
|
||||
logger = Logger("tests/test_api.py")
|
||||
|
Loading…
x
Reference in New Issue
Block a user