Paolo-Fraccaro
commited on
Commit
•
4a5121a
1
Parent(s):
63a485f
add latest changes
Browse files- Dockerfile +8 -27
- app.py +3 -1
Dockerfile
CHANGED
@@ -12,13 +12,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
12 |
|
13 |
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
14 |
|
15 |
-
# RUN echo $(ls /run/secrets/)
|
16 |
-
|
17 |
-
|
18 |
WORKDIR /code
|
19 |
|
20 |
-
# COPY ./requirements.txt /code/requirements.txt
|
21 |
-
|
22 |
# add conda
|
23 |
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -P /code/
|
24 |
RUN chmod 777 /code/Miniconda3-latest-Linux-x86_64.sh
|
@@ -53,45 +48,31 @@ RUN pip3 install setuptools-rust
|
|
53 |
|
54 |
RUN conda install pillow -y
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
RUN conda install -c pytorch pytorch==1.7.1 torchvision==0.8.2
|
59 |
-
# RUN pip install torchvision-cpu==0.8.2
|
60 |
-
|
61 |
-
# WORKDIR /home/user
|
62 |
-
|
63 |
-
# RUN git clone https://github.com/open-mmlab/mim.git
|
64 |
|
65 |
RUN pip3 install openmim
|
66 |
|
67 |
-
|
68 |
RUN conda install -c conda-forge gradio -y
|
69 |
|
70 |
-
|
71 |
-
# RUN --mount=type=secret,id=git_token,mode=0444,required=true \
|
72 |
-
# echo $(https://$(cat /run/secrets/git_token)@github.com/NASA-IMPACT/hls-foundation-os.git)
|
73 |
-
# # git clone https://$(cat /run/secrets/git_token)@github.com/NASA-IMPACT/hls-foundation-os.git
|
74 |
-
|
75 |
WORKDIR /home/user
|
76 |
|
77 |
RUN --mount=type=secret,id=git_token,mode=0444,required=true \
|
78 |
-
git clone https://$(cat /run/secrets/git_token)@github.com/NASA-IMPACT/hls-foundation-os.git
|
79 |
|
80 |
|
81 |
WORKDIR hls-foundation-os
|
82 |
|
83 |
-
RUN pip3 install
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
# pip3 install git+https://$(cat /run/secrets/git_token)@github.com/NASA-IMPACT/hls-foundation-os.git@mmseg-only
|
88 |
-
|
89 |
-
RUN mim install mmcv-full==1.5.0
|
90 |
|
|
|
91 |
# Set the working directory to the user's home directory
|
92 |
WORKDIR $HOME/app
|
93 |
|
|
|
|
|
94 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
95 |
COPY --chown=user . $HOME/app
|
96 |
|
97 |
-
CMD ["python3", "app.py"]
|
|
|
12 |
|
13 |
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
14 |
|
|
|
|
|
|
|
15 |
WORKDIR /code
|
16 |
|
|
|
|
|
17 |
# add conda
|
18 |
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -P /code/
|
19 |
RUN chmod 777 /code/Miniconda3-latest-Linux-x86_64.sh
|
|
|
48 |
|
49 |
RUN conda install pillow -y
|
50 |
|
51 |
+
RUN pip3 install torch==1.11.0+cu115 torchvision==0.12.0+cu115 --extra-index-url https://download.pytorch.org/whl/cu115
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
RUN pip3 install openmim
|
54 |
|
|
|
55 |
RUN conda install -c conda-forge gradio -y
|
56 |
|
|
|
|
|
|
|
|
|
|
|
57 |
WORKDIR /home/user
|
58 |
|
59 |
RUN --mount=type=secret,id=git_token,mode=0444,required=true \
|
60 |
+
git clone --branch mmseg-only https://$(cat /run/secrets/git_token)@github.com/NASA-IMPACT/hls-foundation-os.git
|
61 |
|
62 |
|
63 |
WORKDIR hls-foundation-os
|
64 |
|
65 |
+
RUN pip3 install -e .
|
|
|
66 |
|
67 |
+
RUN mim install mmcv-full==1.6.2 -f https://download.openmmlab.com/mmcv/dist/11.5/1.11.0/index.html
|
|
|
|
|
|
|
68 |
|
69 |
+
RUN pip3 install rasterio scikit-image
|
70 |
# Set the working directory to the user's home directory
|
71 |
WORKDIR $HOME/app
|
72 |
|
73 |
+
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/miniconda/lib"
|
74 |
+
|
75 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
76 |
COPY --chown=user . $HOME/app
|
77 |
|
78 |
+
CMD ["python3", "app.py"]
|
app.py
CHANGED
@@ -184,7 +184,9 @@ def process_test_pipeline(custom_test_pipeline, bands=None):
|
|
184 |
|
185 |
return custom_test_pipeline
|
186 |
|
187 |
-
|
|
|
|
|
188 |
custom_test_pipeline=process_test_pipeline(model.cfg.data.test.pipeline, None)
|
189 |
|
190 |
func = partial(inference_on_file, model=model, custom_test_pipeline=custom_test_pipeline)
|
|
|
184 |
|
185 |
return custom_test_pipeline
|
186 |
|
187 |
+
config = Config.fromfile(config_path)
|
188 |
+
config.model.backbone.pretrained=None
|
189 |
+
model = init_segmentor(config, ckpt, device='cpu')
|
190 |
custom_test_pipeline=process_test_pipeline(model.cfg.data.test.pipeline, None)
|
191 |
|
192 |
func = partial(inference_on_file, model=model, custom_test_pipeline=custom_test_pipeline)
|