diff --git a/docker/Dockerfile b/docker/Dockerfile index 4884546..9b6a70c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,13 +7,21 @@ FROM python:3.12 AS app ARG APP_FOLDER=/app -COPY . ${APP_FOLDER} +RUN pip install tensorflow totalsegmentator + +RUN python `python -c "import os; import totalsegmentator; print(os.path.dirname(totalsegmentator.__file__))"`/download_pretrained_weights.py + +# taken from TotalSegmentator Dockerfile +# https://github.com/wasserth/TotalSegmentator/blob/master/Dockerfile +RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 xvfb -y +RUN pip install fury WORKDIR ${APP_FOLDER} -RUN pip install tensorflow -RUN pip install -r requirements.txt +COPY . ${APP_FOLDER} + +RUN pip install . COPY --from=helper /app/weights.keras ${APP_FOLDER}/checkpoints/weights.keras -CMD ["python", "./src/pancreas_ai/bin/predict.py"] +CMD ["predict"] diff --git a/src/pancreas_ai/bin/predict.py b/src/pancreas_ai/bin/predict.py index b39b411..124d753 100644 --- a/src/pancreas_ai/bin/predict.py +++ b/src/pancreas_ai/bin/predict.py @@ -36,7 +36,7 @@ def is_ct_folder_exists(self): return True def segment(self): - segmentation = totalsegmentator(self.ct_folder, fastest=False) + segmentation = totalsegmentator(self.ct_folder, fastest=False, verbose=True) nib.save(segmentation, self.mask_file) def cancer_probability(self) -> np.array: