Spaces:
Runtime error
Runtime error
`dev`: toy example to explore spaces.
Browse files- Dockerfile +7 -67
- code/app.py +6 -0
- requirements.txt +3 -0
Dockerfile
CHANGED
@@ -1,69 +1,9 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
ARG DEBIAN_FRONTEND=noninteractive
|
4 |
-
ARG COLMAP_VERSION=dev
|
5 |
-
ENV QT_XCB_GL_INTEGRATION=xcb_egl
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
&& apt-get install -y python3.10 python3.10-dev python3-pip python3-distutils python3-setuptools \
|
14 |
-
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 \
|
15 |
-
&& update-alternatives --set python /usr/bin/python3.10 \
|
16 |
-
&& python -m pip install --upgrade pip
|
17 |
-
|
18 |
-
#Install basic utilities.
|
19 |
-
RUN apt install -qy libglib2.0-0 \
|
20 |
-
&& apt install -y openssh-server \
|
21 |
-
&& apt install -y zlib1g-dev \
|
22 |
-
&& apt-get install ffmpeg libsm6 libxext6 -y \
|
23 |
-
&& apt-get install -y --no-install-recommends git wget curl gcc g++ unzip bzip2 build-essential ca-certificates \
|
24 |
-
&& apt-get clean \
|
25 |
-
&& rm -rf /var/lib/apt/lists/*
|
26 |
-
|
27 |
-
# Install Cmake
|
28 |
-
RUN rm -rf /var/lib/apt/lists/* \
|
29 |
-
&& wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-Linux-x86_64.sh -q -O /tmp/cmake-install.sh \
|
30 |
-
&& chmod u+x /tmp/cmake-install.sh \
|
31 |
-
&& mkdir /opt/cmake-3.26.1 \
|
32 |
-
&& /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.26.1 \
|
33 |
-
&& rm /tmp/cmake-install.sh \
|
34 |
-
&& ln -s /opt/cmake-3.26.1/bin/* /usr/local/bin
|
35 |
-
|
36 |
-
|
37 |
-
# Install COLMAP
|
38 |
-
RUN apt-get update && apt-get install -y \
|
39 |
-
ninja-build \
|
40 |
-
build-essential \
|
41 |
-
libboost-program-options-dev \
|
42 |
-
libboost-filesystem-dev \
|
43 |
-
libboost-graph-dev \
|
44 |
-
libboost-system-dev \
|
45 |
-
libboost-test-dev \
|
46 |
-
libeigen3-dev \
|
47 |
-
libflann-dev \
|
48 |
-
libfreeimage-dev \
|
49 |
-
libmetis-dev \
|
50 |
-
libgoogle-glog-dev \
|
51 |
-
libgflags-dev \
|
52 |
-
libsqlite3-dev \
|
53 |
-
libglew-dev \
|
54 |
-
qtbase5-dev \
|
55 |
-
libqt5opengl5-dev \
|
56 |
-
libcgal-dev \
|
57 |
-
libceres-dev
|
58 |
-
RUN apt-get install -y gcc-10 g++-10
|
59 |
-
ENV CC=/usr/bin/gcc-10
|
60 |
-
ENV CXX=/usr/bin/g++-10
|
61 |
-
ENV CUDAHOSTCXX=/usr/bin/g++-10
|
62 |
-
|
63 |
-
RUN git clone https://github.com/colmap/colmap
|
64 |
-
WORKDIR /colmap
|
65 |
-
RUN mkdir build && cd build && cmake .. -GNinja -D CMAKE_CUDA_ARCHITECTURES=75 && ninja && ninja install
|
66 |
-
|
67 |
-
COPY requirements.txt /tmp/requirements.txt
|
68 |
-
# Install python libs.
|
69 |
-
RUN pip install -r /tmp/requirements.txt
|
|
|
1 |
+
FROM --platform=linux/amd64 python:3.10
|
2 |
|
|
|
|
|
|
|
3 |
|
4 |
+
WORKDIR /code
|
5 |
+
COPY requirements.txt /code/requirements.txt
|
6 |
+
COPY code/app.py /code/app.py
|
7 |
+
RUN pip install -r /code/requirements.txt
|
8 |
+
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
9 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
code/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
app = FastAPI()
|
4 |
+
@app.get("/")
|
5 |
+
def read_root():
|
6 |
+
return {"Hello": "World"}
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
fastapi
|
2 |
+
requests
|
3 |
+
uvicorn[standard]
|