Spaces:
Running
Running
File size: 1,370 Bytes
2c939b6 f0c79f8 863aef9 f0c79f8 b99deae ff6011b b99deae f0c79f8 b99deae f0c79f8 b99deae f0c79f8 89f170b 4fbdd2c f0c79f8 8f99b9d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# 1. Install PyTorch first (required by Detectron2)
# Using an older version for compatibility with SAM 3D Body model
RUN pip install --no-cache-dir torch==1.13.1 torchvision==0.14.1
# 2. Install Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# 3. Install Detectron2 (after PyTorch is installed)
RUN pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git@a1ce2f9' --no-build-isolation --no-deps
# 4. Install MoGe
RUN pip install --no-cache-dir git+https://github.com/microsoft/MoGe.git
# 5. Clone SAM 3D Body repository (not a standard Python package)
RUN git clone https://github.com/facebookresearch/sam-3d-body.git /app/sam-3d-body
# Copy application code
COPY app/ ./app/
# Create required directories
RUN mkdir -p outputs temp
# Set environment variables
ENV PORT=7860
ENV PYTHONUNBUFFERED=1
# Expose the port
EXPOSE 7860
# Change the working directory to ensure imports work correctly
WORKDIR /app
# Start the application with the correct module path
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |