Download Dockerfile from devusman/translate: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/spaces/devusman/translate/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/devusman/translate/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/devusman/translate/resolve/main/Dockerfile
813 Bytes
| FROM python:3.10-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| WORKDIR /app | |
| # system deps for sentencepiece & build | |
| RUN apt-get update && apt-get install -y git build-essential | |
| # copy code | |
| COPY . /app | |
| # install python deps | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # Ensure model is downloaded at build-time to speed cold-start (optional) | |
| # You can uncomment the following to pre-cache HF model in the image: | |
| RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; AutoTokenizer.from_pretrained('Helsinki-NLP/opus-mt-en-ar'); AutoModelForSeq2SeqLM.from_pretrained('Helsinki-NLP/opus-mt-en-ar')" | |
| # Use gunicorn for production inside Space | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app", "--workers", "1", "--threads", "4", "--timeout", "300"] | |