Spaces:
Paused
Paused
File size: 1,323 Bytes
87d02d9 5aec95b f0ca182 87d02d9 5a6ab66 f0ca182 5aec95b 87d02d9 5aec95b 11dcc48 6c36b16 87d02d9 6c36b16 87d02d9 5aec95b c28ae5e 5aec95b 11dcc48 5aec95b 11dcc48 6c36b16 11dcc48 6c36b16 9ad00f2 6c36b16 5aec95b 5a6ab66 5aec95b 6c36b16 5aec95b 6c36b16 11dcc48 5aec95b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | FROM python:3.10-slim
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV FORCE_CUDA=0
ENV TORCH_CUDA_ARCH_LIST=""
ENV HF_HOME=/app/hf_cache
RUN apt-get update && apt-get install -y \
git gcc g++ ninja-build cmake \
libglib2.0-0 libsm6 libxext6 \
libgl1 libgomp1 \
python3-dev build-essential \
&& rm -rf /var/lib/apt/lists/*
# Pin numpy<2 before anything else
RUN pip install --no-cache-dir "numpy<2"
RUN pip install --no-cache-dir \
torch==2.1.0+cpu \
torchvision==0.16.0+cpu \
--index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir \
'git+https://github.com/facebookresearch/detectron2.git' \
--no-build-isolation
# Upgrade Gradio to 4.x to fix the Jinja2 unhashable dict bug
# Pin Jinja2 explicitly to avoid future breakage
RUN pip install --no-cache-dir \
"gradio>=4.44.1" \
"huggingface_hub>=0.19.4" \
"opencv-python-headless" \
"Pillow>=9.0,<12.0" \
"jinja2>=3.1.2,<4.0"
# Force numpy back to <2 in case any step above upgraded it
RUN pip install --no-cache-dir "numpy<2" --force-reinstall
RUN mkdir -p /app/hf_cache && \
useradd -m -u 1000 user && \
chown -R user:user /app
USER user
COPY --chown=user . /app
EXPOSE 7860
# Fix: use the actual filename, not a markdown hyperlink
CMD ["python", "app.py"] |