| FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 |
| LABEL maintainer="Hugging Face" |
|
|
| ARG DEBIAN_FRONTEND=noninteractive |
|
|
| RUN useradd -m -u 1000 user |
|
|
| |
| USER user |
|
|
| |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| WORKDIR /code |
|
|
| COPY --chown=user ./requirements.txt /code/requirements.txt |
|
|
| USER root |
|
|
| RUN apt update |
| RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg |
| RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y |
|
|
| ARG PYTORCH='2.0.1' |
| ARG TORCH_VISION='' |
| ARG TORCH_AUDIO='' |
| |
| ARG CUDA='cu118' |
|
|
| RUN python3 -m pip install --no-cache-dir --upgrade pip |
| RUN [ ${#PYTORCH} -gt 0 ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA |
| RUN [ ${#TORCH_VISION} -gt 0 ] && VERSION='torchvision=='TORCH_VISION'.*' || VERSION='torchvision'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA |
| RUN [ ${#TORCH_AUDIO} -gt 0 ] && VERSION='torchaudio=='TORCH_AUDIO'.*' || VERSION='torchaudio'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA |
|
|
| RUN python3 -m pip install --no-cache-dir --upgrade -r /code/requirements.txt |
|
|
| ENV OPENAI_API_KEY="<PASTE YOUR OPENAI KEY HERE>" |
| ENV GOOGLE_APPLICATION_CREDENTIALS="<PASTE THE PATH TO YOUR GOOGLE CREDENTIALS JSON FILE HERE>" |
|
|
| USER user |
|
|
| COPY --chown=user . . |
|
|
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|