Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download Dockerfile from Sandflow/sand3d-explorer: direct link, hf CLI and curl.
- Browser
- Download file 858 Bytes
-
https://huggingface.co/spaces/Sandflow/sand3d-explorer/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Sandflow/sand3d-explorer/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Sandflow/sand3d-explorer/resolve/main/Dockerfile
858 Bytes
| # Sand3D Explorer on a free CPU Space: FastAPI + a static page, torch CPU for the query encoder. | |
| FROM python:3.11-slim | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH PYTHONUNBUFFERED=1 \ | |
| HF_HOME=/home/user/.cache/huggingface EXPLORER_DATA=/home/user/data | |
| WORKDIR /home/user/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir torch==2.15.0 torchvision==0.29.2 --index-url https://download.pytorch.org/whl/cpu \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| USER user | |
| # the text encoder's weights, fetched at build so a cold start does not wait on them | |
| RUN python -c "import open_clip; open_clip.create_model_and_transforms('ViT-B-32', pretrained='laion2b_s34b_b79k')" | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |