File size: 1,527 Bytes
803add0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713d895
ccf4b11
803add0
 
 
aeff6b4
 
36ef01c
 
 
 
 
 
1779c3f
ccf4b11
1779c3f
ccf4b11
803add0
304c9ed
5b0922a
803add0
 
2e1a994
803add0
f1b53d3
 
 
803add0
 
 
f1b53d3
803add0
 
 
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
50
51
52
53
54
55
56
57
FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    libssl-dev \
    pkg-config \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user
USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    HF_HOME=/home/user/.cache/huggingface \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

WORKDIR $HOME/app

RUN pip install --upgrade pip

ARG HYPERVIEW_VERSION=0.6.2
ARG HYPER_MODELS_VERSION=0.3.0

# Install CPU-only PyTorch first so the Space does not pull the default CUDA bundle.
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
RUN echo "Installing hyperview==${HYPERVIEW_VERSION}" \
    && pip install "hyperview==${HYPERVIEW_VERSION}" \
    && python - <<'PY'
import inspect
import hyperview as hv

print("hyperview", hv.__version__, inspect.signature(hv.launch))
PY
RUN pip install \
    "hyper-models[ml]==${HYPER_MODELS_VERSION}" \
    "datasets>=4.5.0" \
    "Pillow>=12.0.0"

COPY --chown=user . .

ENV HYPERVIEW_HOST=0.0.0.0 \
    HYPERVIEW_PORT=7860 \
    HYPERVIEW_WORKSPACE_ID=abo-catalog-clip-hyper3clip-split \
    HYPERVIEW_DATASETS_DIR=/home/user/app/demo_data/datasets \
    HYPERVIEW_MEDIA_DIR=/home/user/app/demo_data/media \
    HF_HUB_ETAG_TIMEOUT=30 \
    HF_HUB_DOWNLOAD_TIMEOUT=120

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=2700s --retries=3 \
    CMD curl -f http://localhost:7860/__hyperview__/health || exit 1

CMD ["python", "demo.py"]