Spaces:
Runtime error
Runtime error
fix
Browse filesFiles changed (2)
- Dockerfile+13-16
- app.py+3
12123458678910111112131415151617171819202120212223242526252728293030313232333334353636373840394041424345444745# GPU Space (Docker SDK). Torch 1.10 + cu111 + Detectron2 0.6# Base matches CUDA 11.1 + cuDNN 8 for T4 compatibilityFROM nvidia/cuda:11.1.1-cudnn8-runtime-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive \ PIP_NO_CACHE_DIR=1 \ FORCE_CUDA=1 \ OMP_NUM_THREADS=1 \ # make logs quiet + speed up matplotlib MPLCONFIGDIR=/tmp/matplotlib \ # avoid libgomp complaint OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 NUMEXPR_NUM_THREADS=1 \ GRADIO_SERVER_NAME=0.0.0.0
# System deps (keep lean; include GDAL tools, OpenCV runtime deps, etc.)RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip python3-dev build-essential git curl wget \ libgl1 ffmpeg gdal-bin libspatialindex-dev ca-certificates \ && rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/* && mkdir -p /tmp/matplotlib
# Python basics# Keep setuptools old enough for torch 1.x wheel toolingRUN python3 -m pip install --upgrade pip setuptools==59.5.0 wheel
# ---- Core ML stack pinned to Torch 1.x (cu111) ----# Torch 1.10 and torchvision 0.11.1 wheels for CUDA 11.1# --- Pin Pillow BEFORE detectron2 to avoid Pillow 10+ breakage ---RUN python3 -m pip install "pillow==9.5.0"
# Core ML stack (Torch 1.x + cu111 + D2 0.6)RUN python3 -m pip install --extra-index-url https://download.pytorch.org/whl/cu111 \ torch==1.10.0+cu111 torchvision==0.11.1+cu111
# Detectron2 v0.6 prebuilt wheels for torch1.10 + cu111RUN python3 -m pip install -f \ https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.10/index.html \ detectron2==0.6
# Geospatial + web UI libs. detectree2 comes from GitHub.# Geospatial + UIRUN python3 -m pip install \ gradio==4.* \ rasterio geopandas shapely matplotlib pillow \ gradio==4.* rasterio geopandas shapely matplotlib pillow==9.5.0 \ "git+https://github.com/PatBall1/detectree2.git"
# App codeWORKDIR /appCOPY app.py /app/app.py
# Download a pretrained model (forest) at build time# Pretrained modelRUN mkdir -p /models && \ wget -q -O /models/230103_randresize_full.pth \ https://zenodo.org/records/10522461/files/230103_randresize_full.pth
# Gradio default port (Spaces will map $PORT for us)EXPOSE 7860
CMD ["python3", "app.py"]1234567import os, tempfile, shutil, uuid, warningsos.environ.setdefault("OMP_NUM_THREADS", "1")os.environ.setdefault("MPLCONFIGDIR", "/tmp/matplotlib")os.makedirs(os.environ["MPLCONFIGDIR"], exist_ok=True)warnings.filterwarnings("ignore")
import matplotlibDockerfile+13-16
app.py+3