File size: 3,184 Bytes
fc90132
 
 
 
 
 
 
 
2eb2dc9
8d80236
2eb2dc9
 
 
 
 
 
fc90132
 
f67e578
 
 
363d6df
23102fd
0b53ce6
48fa77f
23102fd
 
 
 
48fa77f
cee4449
 
48fa77f
cee4449
48fa77f
23102fd
 
 
 
bdfac22
 
 
 
 
23102fd
 
bdfac22
23102fd
 
bdfac22
48fa77f
fc90132
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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"]