Spaces:
Sleeping
Sleeping
Download Dockerfile from phamluan/namboqa-api: direct link, hf CLI and curl.
- Browser
- Download file 964 Bytes
-
https://huggingface.co/spaces/phamluan/namboqa-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/phamluan/namboqa-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/phamluan/namboqa-api/resolve/main/Dockerfile
964 Bytes
| # Hugging Face Space (SDK: Docker) — CPU basic là đủ | |
| FROM python:3.11-slim | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| PYTHONUNBUFFERED=1 \ | |
| TOKENIZERS_PARALLELISM=false | |
| WORKDIR /home/user/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user torch --index-url https://download.pytorch.org/whl/cpu \ | |
| && pip install --no-cache-dir --user -r requirements.txt | |
| # Space variables được truyền vào lúc build dưới dạng build-arg | |
| ARG RETRIEVER_MODEL=bkai-foundation-models/vietnamese-bi-encoder | |
| ARG READER_MODEL=deepset/xlm-roberta-base-squad2 | |
| COPY --chown=user preload.py . | |
| RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=false \ | |
| HF_TOKEN=$(cat /run/secrets/HF_TOKEN 2>/dev/null || true) python preload.py | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |