# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # you will also find guides on how best to write your Dockerfile FROM python:3.9 WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y # Download and extract unrar RUN wget https://www.rarlab.com/rar/rarlinux-x64-700.tar.gz && \ tar -zxvf rarlinux-x64-700.tar.gz && \ cp rar/rar /usr/local/bin && \ cp rar/unrar /usr/local/bin && \ rm -rf rarlinux-x64-700.tar.gz rar RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a folder named 'weights' RUN mkdir /weights RUN mkdir /code/weights RUN mkdir /code/models RUN mkdir /code/dataset # RUN wget -O /code/weights/age_model_weights.h5 https://github.com/serengil/deepface_models/releases/download/v1.0/age_model_weights.h5 # RUN wget -O /code/weights/facial_expression_model_weights.h5 https://github.com/serengil/deepface_models/releases/download/v1.0/facial_expression_model_weights.h5 # RUN wget -O /code/weights/gender_model_weights.h5 https://github.com/serengil/deepface_models/releases/download/v1.0/gender_model_weights.h5 # RUN wget -O /code/weights/race_model_single_batch.h5 https://github.com/serengil/deepface_models/releases/download/v1.0/race_model_single_batch.h5 RUN wget -O /code/weights/shape_predictor_5_face_landmarks.dat.bz2 http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2 RUN bunzip2 /code/weights/shape_predictor_5_face_landmarks.dat.bz2 RUN wget -O /code/weights/ghostfacenet_v1.h5 https://github.com/HamadYA/GhostFaceNets/releases/download/v1.2/GhostFaceNet_W1.3_S1_ArcFace.h5 RUN wget -O /code/models/mivolo_imbd.pth.tar "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/mivolo_imbd.pth.tar" RUN wget -O /code/models/yolov8x_person_face.pt "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/yolov8x_person_face.pt" # download the dataset RUN wget -O /code/dataset/dataset.part1.rar "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/dataset.part1.rar" RUN wget -O /code/dataset/dataset.part2.rar "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/dataset.part2.rar" RUN wget -O /code/dataset/dataset.part3.rar "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/dataset.part3.rar" RUN wget -O /code/dataset/dataset.part4.rar "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/dataset.part4.rar" RUN wget -O /code/dataset/dataset.part5.rar "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/dataset.part5.rar" # install unrar and extract the dataset RUN unrar x /code/dataset/dataset.part1.rar /code/dataset # download the trained dataset model RUN wget -O /code/dataset/ds_ghostfacenet_opencv_v2.pkl "https://github.com/ManavSarkar/face-matching-with-celebrity/releases/download/development-02/ds_ghostfacenet_opencv_v2.pkl" COPY . . CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]