mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
Make the API /verify work with image URL
This commit is contained in:
parent
cc484b54be
commit
7d2da1eb59
16
Dockerfile
16
Dockerfile
@ -1,6 +1,6 @@
|
|||||||
# base image
|
# base image
|
||||||
FROM python:3.8.12
|
FROM python:3.8.12
|
||||||
LABEL org.opencontainers.image.source https://github.com/serengil/deepface
|
LABEL org.opencontainers.image.source=https://github.com/serengil/deepface
|
||||||
|
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# create required folder
|
# create required folder
|
||||||
@ -24,15 +24,11 @@ RUN apt-get update && apt-get install -y \
|
|||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# Copy required files from repo into image
|
|
||||||
COPY ./deepface /app/deepface
|
|
||||||
# even though we will use local requirements, this one is required to perform install deepface from source code
|
# even though we will use local requirements, this one is required to perform install deepface from source code
|
||||||
COPY ./requirements.txt /app/requirements.txt
|
COPY ./requirements.txt /app/requirements.txt
|
||||||
COPY ./requirements_local /app/requirements_local.txt
|
COPY ./requirements_local /app/requirements_local.txt
|
||||||
COPY ./package_info.json /app/
|
COPY ./package_info.json /app/
|
||||||
COPY ./setup.py /app/
|
|
||||||
COPY ./README.md /app/
|
|
||||||
COPY ./entrypoint.sh /app/deepface/api/src/entrypoint.sh
|
|
||||||
|
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# if you plan to use a GPU, you should install the 'tensorflow-gpu' package
|
# if you plan to use a GPU, you should install the 'tensorflow-gpu' package
|
||||||
@ -46,6 +42,14 @@ COPY ./entrypoint.sh /app/deepface/api/src/entrypoint.sh
|
|||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# install dependencies - deepface with these dependency versions is working
|
# install dependencies - deepface with these dependency versions is working
|
||||||
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -r /app/requirements_local.txt
|
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -r /app/requirements_local.txt
|
||||||
|
|
||||||
|
# Copy required files from repo into image
|
||||||
|
COPY ./deepface /app/deepface
|
||||||
|
|
||||||
|
COPY ./setup.py /app/
|
||||||
|
COPY ./README.md /app/
|
||||||
|
COPY ./entrypoint.sh /app/deepface/api/src/entrypoint.sh
|
||||||
|
|
||||||
# install deepface from source code (always up-to-date)
|
# install deepface from source code (always up-to-date)
|
||||||
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -e .
|
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -e .
|
||||||
|
|
||||||
|
@ -623,5 +623,7 @@ def detectFace(
|
|||||||
extracted_face = None
|
extracted_face = None
|
||||||
if len(face_objs) > 0:
|
if len(face_objs) > 0:
|
||||||
extracted_face = face_objs[0]["face"]
|
extracted_face = face_objs[0]["face"]
|
||||||
extracted_face = preprocessing.resize_image(img=extracted_face, target_size=target_size)
|
extracted_face = preprocessing.resize_image(
|
||||||
|
img=extracted_face, target_size=target_size
|
||||||
|
)
|
||||||
return extracted_face
|
return extracted_face
|
||||||
|
@ -16,3 +16,6 @@ def create_app():
|
|||||||
app.register_blueprint(blueprint)
|
app.register_blueprint(blueprint)
|
||||||
logger.info(f"Welcome to DeepFace API v{DeepFace.__version__}!")
|
logger.info(f"Welcome to DeepFace API v{DeepFace.__version__}!")
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
app = create_app()
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
echo "Starting the application..."
|
echo "Starting the application..."
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
||||||
gunicorn -w 1 -b 0.0.0.0:5000 --timeout 7200 --log-level 'debug' --access-logfile - --access-logformat '%(h)s - - [%(t)s] "%(r)s" %(s)s %(b)s %(L)s' app:create_app
|
gunicorn -w 1 -b 0.0.0.0:5000 --timeout 7200 --log-level 'debug' --access-logfile - --access-logformat '%(h)s - - [%(t)s] "%(r)s" %(s)s %(b)s %(L)s' app:app
|
20
scripts/mh_use_api.py
Normal file
20
scripts/mh_use_api.py
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user