Ubuntu commited on
Commit
e3598ee
1 Parent(s): 7e8852b

add: docker

Browse files
Files changed (6) hide show
  1. .gitignore +0 -1
  2. Dockerfile +26 -0
  3. app.py +16 -8
  4. build_docker.sh +3 -0
  5. env-docker.txt +31 -0
  6. run_docker.sh +1 -0
.gitignore CHANGED
@@ -14,7 +14,6 @@ __pycache__
14
  Untitled*
15
  experiments
16
  third_party/REKD
17
- Dockerfile
18
  hloc/matchers/dedode.py
19
  gradio_cached_examples
20
 
 
14
  Untitled*
15
  experiments
16
  third_party/REKD
 
17
  hloc/matchers/dedode.py
18
  gradio_cached_examples
19
 
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official conda-based Python image as a parent image
2
+ FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
3
+
4
+ LABEL maintainer vincentqyw
5
+ ARG PYTHON_VERSION=3.10.4
6
+ # Set the working directory to /code
7
+ WORKDIR /code
8
+ # Copy the current directory contents into the container at /code
9
+ COPY . /code
10
+
11
+ RUN conda create -n imw python=${PYTHON_VERSION}
12
+ RUN echo "source activate imw" > ~/.bashrc
13
+ ENV PATH /opt/conda/envs/imw/bin:$PATH
14
+
15
+ # Make RUN commands use the new environment
16
+ SHELL ["conda", "run", "-n", "imw", "/bin/bash", "-c"]
17
+ RUN pip install --upgrade pip
18
+
19
+ #RUN pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
20
+ RUN pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118
21
+ RUN pip install -r env-docker.txt
22
+
23
+ RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
24
+
25
+ # Export port
26
+ EXPOSE 7860
app.py CHANGED
@@ -79,7 +79,7 @@ def ui_reset_state(*args):
79
 
80
 
81
  # "footer {visibility: hidden}"
82
- def run(config):
83
  """
84
  Runs the application.
85
 
@@ -329,18 +329,26 @@ def run(config):
329
  ],
330
  outputs=[output_wrapped, geometry_result],
331
  )
332
-
333
- app.queue().launch(share=False)
 
334
 
335
 
336
  if __name__ == "__main__":
337
  parser = argparse.ArgumentParser()
338
  parser.add_argument(
339
- "--config_path",
340
  type=str,
341
- default="config.yaml",
342
- help="configuration file path",
 
 
 
 
 
 
343
  )
 
344
  args = parser.parse_args()
345
- config = None
346
- run(config)
 
79
 
80
 
81
  # "footer {visibility: hidden}"
82
+ def run(server_name="127.0.0.1", server_port=7860):
83
  """
84
  Runs the application.
85
 
 
329
  ],
330
  outputs=[output_wrapped, geometry_result],
331
  )
332
+ app.queue().launch(
333
+ server_name=server_name, server_port=server_port, share=False
334
+ )
335
 
336
 
337
  if __name__ == "__main__":
338
  parser = argparse.ArgumentParser()
339
  parser.add_argument(
340
+ "--server_name",
341
  type=str,
342
+ default="127.0.0.1",
343
+ help="server name",
344
+ )
345
+ parser.add_argument(
346
+ "--server_port",
347
+ type=int,
348
+ default=7860,
349
+ help="server port",
350
  )
351
+
352
  args = parser.parse_args()
353
+ run(args.server_name, args.server_port)
354
+
build_docker.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ docker build -t image-matching-webui:latest . --no-cache
2
+ docker tag image-matching-webui:latest vincentqin/image-matching-webui:latest
3
+ docker push vincentqin/image-matching-webui:latest
env-docker.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ e2cnn==0.2.3
2
+ einops==0.6.1
3
+ gdown==4.7.1
4
+ gradio==4.25.0
5
+ gradio_client==0.15.0
6
+ h5py==3.9.0
7
+ imageio==2.31.1
8
+ Jinja2==3.1.2
9
+ kornia==0.6.12
10
+ loguru==0.7.0
11
+ matplotlib==3.7.1
12
+ numpy==1.23.5
13
+ omegaconf==2.3.0
14
+ opencv-contrib-python==4.6.0.66
15
+ opencv-python==4.6.0.66
16
+ pandas==2.0.3
17
+ plotly==5.15.0
18
+ protobuf==4.23.2
19
+ pycolmap==0.5.0
20
+ pytlsd==0.0.2
21
+ pytorch-lightning==1.4.9
22
+ PyYAML==6.0
23
+ scikit-image==0.21.0
24
+ scikit-learn==1.2.2
25
+ scipy==1.11.1
26
+ seaborn==0.12.2
27
+ shapely==2.0.1
28
+ tensorboardX==2.6.1
29
+ torchmetrics==0.6.0
30
+ tqdm==4.65.0
31
+ yacs==0.1.8
run_docker.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ docker run -it -p 7860:7860 vincentqin/image-matching-webui:latest python app.py --server_name "0.0.0.0" --server_port=7860