| |
| |
|
|
| |
| FROM python:3.10-slim AS model-builder |
|
|
| |
| RUN pip install huggingface_hub |
|
|
| |
| RUN python -c "\ |
| from huggingface_hub import hf_hub_download; \ |
| hf_hub_download('sematech/sema-utils', 'spm.model'); \ |
| hf_hub_download('sematech/sema-utils', 'lid218e.bin'); \ |
| hf_hub_download('sematech/sema-utils', 'translation_models/sematrans-3.3B/model.bin'); \ |
| hf_hub_download('sematech/sema-utils', 'translation_models/sematrans-3.3B/config.json'); \ |
| hf_hub_download('sematech/sema-utils', 'translation_models/sematrans-3.3B/shared_vocabulary.txt')" |
|
|
| |
| FROM python:3.10-slim |
|
|
| |
| RUN useradd -m -u 1000 user |
| |
| |
| USER user |
| |
| |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| |
| WORKDIR $HOME/app |
|
|
| |
| ENV HF_HUB_OFFLINE=1 |
| ENV TRANSFORMERS_NO_ADVISORY_WARNINGS=1 |
|
|
| |
| COPY --chown=user ./requirements.txt requirements.txt |
| RUN pip install --no-cache-dir --upgrade pip |
| RUN pip install --no-cache-dir --user -r requirements.txt |
|
|
| |
| COPY --chown=user --from=model-builder /root/.cache/huggingface $HOME/.cache/huggingface |
|
|
| |
| COPY --chown=user ./app app |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|