Spaces:
Running on Zero
Running on Zero
| FROM python:3.10-slim | |
| # HF Spaces runs containers as UID 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface | |
| WORKDIR /home/user/app | |
| # NOTE: this Dockerfile is NOT used by the deployed Space — README.md sets | |
| # `sdk: gradio`, so HF Spaces builds from requirements.txt on the managed | |
| # Gradio image and ignores this file entirely. It is kept only for local | |
| # Docker testing. ZeroGPU (spaces.GPU) is only supported on Gradio-SDK | |
| # Spaces, not Docker-SDK Spaces, so this file must never become the actual | |
| # build path if ZeroGPU is required. | |
| # Install PyTorch with CUDA support (default PyPI index) so torch.cuda is | |
| # available — ZeroGPU attaches a real GPU to the process at call time, so a | |
| # CPU-only wheel would make torch.cuda.is_available() return False. | |
| RUN pip install --no-cache-dir --user \ | |
| torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 | |
| # Install remaining dependencies | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Pre-download ProtT5-XL at build time so users never wait for it | |
| RUN python -c "\ | |
| from huggingface_hub import snapshot_download; \ | |
| snapshot_download('Rostlab/prot_t5_xl_half_uniref50-enc')" | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |