Spaces:
Sleeping
Sleeping
| FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install base dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y software-properties-common && \ | |
| add-apt-repository ppa:deadsnakes/ppa && \ | |
| apt-get update && \ | |
| apt-get install -y \ | |
| python3.10 \ | |
| python3.10-venv \ | |
| python3.10-distutils \ | |
| python3-pip \ | |
| wget \ | |
| git \ | |
| libgl1 \ | |
| fontconfig \ | |
| libglib2.0-0 \ | |
| libxrender1 \ | |
| libsm6 \ | |
| libxext6 \ | |
| poppler-utils && \ | |
| rm -rf /var/lib/apt/lists/* | |
| RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 | |
| # Create app directory | |
| WORKDIR /app | |
| # Copy requirements first | |
| COPY requirements.txt . | |
| # Install PyTorch dependencies with explicit compatible versions for NVIDIA L4 | |
| RUN pip3 install --no-cache-dir --upgrade pip && \ | |
| pip3 install --no-cache-dir torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121 && \ | |
| pip3 install --no-cache-dir transformers==4.36.2 && \ | |
| pip3 install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY . . | |
| # Expose port | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["python3", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |