# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # you will also find guides on how best to write your Dockerfile FROM python:3.9 # Create a new user and set the working directory RUN useradd -m -u 1000 user WORKDIR /app # Set the CUDA_HOME environment variable ENV CUDA_HOME=/usr/local/cuda # Copy and install Python dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Install specific versions of PyTorch and other dependencies RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118 \ && pip install -U xformers --index-url https://download.pytorch.org/whl/cu118 # Clone and install the modified gaussian splatting repository RUN git clone --recursive https://github.com/ashawkey/diff-gaussian-rasterization \ && pip install ./diff-gaussian-rasterization # Install nvdiffrast for mesh extraction RUN pip install git+https://github.com/NVlabs/nvdiffrast # Create a directory for pretrained models and download the model RUN mkdir /app/pretrained && cd /app/pretrained \ && wget https://huggingface.co/ashawkey/LGM/resolve/main/model_fp16_fixrot.safetensors # Copy the application code COPY --chown=user . /app # Set the command to run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]