Spaces:
Running
Running
File size: 1,003 Bytes
f6bf24b | 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 | FROM python:3.10-slim
# System deps for git (to clone Kronos) and a couple of build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces run as user 1000
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:${PATH}"
WORKDIR /home/user/app
# Install Python deps first (better layer caching)
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Clone the Kronos repo so we can import its `model` package
RUN git clone --depth 1 https://github.com/shiyu-coder/Kronos.git \
/home/user/app/Kronos
# Pre-download the model weights at build time so the Space starts fast
RUN python -c "\
from huggingface_hub import snapshot_download; \
snapshot_download('NeoQuasar/Kronos-Tokenizer-2k'); \
snapshot_download('NeoQuasar/Kronos-mini'); \
print('Weights cached.')"
COPY --chown=user app.py .
EXPOSE 7860
CMD ["python", "app.py"]
|