|
FROM python:3.11-slim-bookworm |
|
|
|
|
|
LABEL org.opencontainers.image.authors="Bram Vanroy" |
|
LABEL org.opencontainers.image.title="MAchine Translation Evaluation Online - Demo" |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
build-essential \ |
|
curl \ |
|
git \ |
|
&& apt-get clean \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN useradd -m -u 1000 mateo_user |
|
USER mateo_user |
|
ENV HOME="/home/mateo_user" |
|
|
|
|
|
ENV PORT=7860 \ |
|
SERVER="localhost" \ |
|
HF_HUB_ENABLE_HF_TRANSFER=1 \ |
|
PATH="${HOME}/.local/bin:${PATH}" \ |
|
USE_CUDA=false |
|
|
|
WORKDIR ${HOME}/mateo |
|
|
|
|
|
RUN git clone https://github.com/BramVanroy/mateo-demo.git |
|
WORKDIR mateo-demo |
|
|
|
|
|
RUN python -m pip install --no-cache-dir --upgrade pip wheel setuptools \ |
|
&& python -m pip install --no-cache-dir torch==2.2.1+cpu -f https://download.pytorch.org/whl/torch \ |
|
&& python -m pip install --no-cache-dir --upgrade . |
|
|
|
|
|
RUN huggingface-cli download bert-base-multilingual-cased model.safetensors tokenizer.json vocab.txt; \ |
|
huggingface-cli download facebook/nllb-200-distilled-600M pytorch_model.bin sentencepiece.bpe.model tokenizer.json; \ |
|
python -c "import comet; from comet import download_model; download_model('Unbabel/wmt22-comet-da')"; \ |
|
python -c "import evaluate; evaluate.load('bleurt', 'BLEURT-20')" |
|
|
|
|
|
EXPOSE $PORT |
|
|
|
|
|
HEALTHCHECK CMD curl --fail http://$SERVER:$PORT/_stcore/health || exit 1 |
|
|
|
|
|
WORKDIR src/mateo_st |
|
|
|
|
|
CMD streamlit run 01_🎈_MATEO.py --server.port $PORT --server.enableXsrfProtection false -- --no_cuda |
|
|