Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 858 Bytes
e6ba88a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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"]
|