Spaces:
Sleeping
Sleeping
Download Dockerfile from NickyBZhangLab/tnikscore: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/NickyBZhangLab/tnikscore/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/NickyBZhangLab/tnikscore/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/NickyBZhangLab/tnikscore/resolve/main/Dockerfile
1.23 kB
| FROM python:3.11-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PORT=7860 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libxrender1 libxext6 libsm6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # HF Spaces drops privileges to UID 1000 at runtime — set up the matching user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Bake ChemBERTa into the image as safetensors. Upstream ships pytorch_model.bin | |
| # only — load it once at build time and re-save as safetensors so runtime can | |
| # always pass use_safetensors=True (works regardless of torch version). | |
| RUN python -c "from transformers import AutoModel, AutoTokenizer; \ | |
| m = AutoModel.from_pretrained('DeepChem/ChemBERTa-77M-MLM'); \ | |
| t = AutoTokenizer.from_pretrained('DeepChem/ChemBERTa-77M-MLM'); \ | |
| m.save_pretrained('/home/user/app/chemberta_local', safe_serialization=True); \ | |
| t.save_pretrained('/home/user/app/chemberta_local')" | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"] | |