Spaces:
Paused
Paused
sivaratrisrinivas commited on
Commit ·
8dbc4bc
1
Parent(s): f1ff7bb
chore: add hugging face docker deployment
Browse files- .dockerignore +12 -0
- Dockerfile +31 -0
- README.md +32 -0
.dockerignore
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git
|
| 2 |
+
.venv
|
| 3 |
+
.uv-cache
|
| 4 |
+
.runtime
|
| 5 |
+
.env
|
| 6 |
+
__pycache__
|
| 7 |
+
*.pyc
|
| 8 |
+
.pytest_cache
|
| 9 |
+
.mypy_cache
|
| 10 |
+
.ruff_cache
|
| 11 |
+
docs
|
| 12 |
+
tests
|
Dockerfile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
|
| 2 |
+
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
+
PYTHONUNBUFFERED=1 \
|
| 5 |
+
UV_CACHE_DIR=/home/ubuntu/.cache/uv \
|
| 6 |
+
HF_HOME=/home/ubuntu/.cache/huggingface \
|
| 7 |
+
TRANSFORMERS_CACHE=/home/ubuntu/.cache/huggingface/transformers \
|
| 8 |
+
DIFFUSERS_CACHE=/home/ubuntu/.cache/huggingface/diffusers
|
| 9 |
+
|
| 10 |
+
RUN apt-get update \
|
| 11 |
+
&& apt-get install -y --no-install-recommends \
|
| 12 |
+
ca-certificates \
|
| 13 |
+
curl \
|
| 14 |
+
python3.12 \
|
| 15 |
+
python3.12-venv \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
COPY --from=ghcr.io/astral-sh/uv:0.5.31 /uv /uvx /usr/local/bin/
|
| 19 |
+
|
| 20 |
+
USER ubuntu
|
| 21 |
+
WORKDIR /home/ubuntu/app
|
| 22 |
+
|
| 23 |
+
COPY --chown=ubuntu:ubuntu pyproject.toml uv.lock README.md ./
|
| 24 |
+
COPY --chown=ubuntu:ubuntu catbox ./catbox
|
| 25 |
+
COPY --chown=ubuntu:ubuntu experiments ./experiments
|
| 26 |
+
|
| 27 |
+
RUN uv sync --frozen --no-dev
|
| 28 |
+
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
CMD ["uv", "run", "--no-sync", "python", "-m", "catbox.browser_ui", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# catBox
|
| 2 |
|
| 3 |
Catbox is an interactive image-generation demo. You open a sealed box, a local
|
|
@@ -155,3 +161,29 @@ For the complete first-observation GPU validation checklist, including Browser
|
|
| 155 |
UI readiness, normal observation, forced Dev Controls outcomes, runtime timing,
|
| 156 |
ephemeral output files, and failure retry/reset behavior, see
|
| 157 |
`docs/manual-gpu-validation.md`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Catbox
|
| 3 |
+
sdk: docker
|
| 4 |
+
app_port: 7860
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
# catBox
|
| 8 |
|
| 9 |
Catbox is an interactive image-generation demo. You open a sealed box, a local
|
|
|
|
| 161 |
UI readiness, normal observation, forced Dev Controls outcomes, runtime timing,
|
| 162 |
ephemeral output files, and failure retry/reset behavior, see
|
| 163 |
`docs/manual-gpu-validation.md`.
|
| 164 |
+
|
| 165 |
+
## Deploy on Hugging Face Spaces
|
| 166 |
+
|
| 167 |
+
The preferred public deployment target is a Docker Hugging Face Space with GPU
|
| 168 |
+
hardware. The container serves Catbox on port `7860`, which is the default
|
| 169 |
+
external port for Spaces.
|
| 170 |
+
|
| 171 |
+
Create a new Hugging Face Space with these settings:
|
| 172 |
+
|
| 173 |
+
- SDK: Docker
|
| 174 |
+
- Visibility: Public or Protected
|
| 175 |
+
- Hardware: start with `1x Nvidia L4`; use `Nvidia A10G - small` if L4 is too
|
| 176 |
+
slow or unavailable
|
| 177 |
+
|
| 178 |
+
Add a Space secret named `HF_TOKEN` if the model download requires
|
| 179 |
+
authenticated Hugging Face access.
|
| 180 |
+
|
| 181 |
+
Push this repository's contents to the Space git remote. The Space README
|
| 182 |
+
metadata at the top of this file tells Hugging Face to build the Docker image
|
| 183 |
+
and expose port `7860`. The Space will start `python -m catbox.browser_ui`,
|
| 184 |
+
download `sd-turbo` on first startup if it is not already cached, and serve the
|
| 185 |
+
app from the Space URL.
|
| 186 |
+
|
| 187 |
+
Generated outcomes and Captured Denoising Trace frames are still ephemeral in
|
| 188 |
+
the deployed container. They are written under `.runtime/generated-outcomes` and
|
| 189 |
+
may be lost when the Space restarts.
|