File size: 1,382 Bytes
8dc54dd
06e9d12
8dc54dd
 
 
 
 
 
 
 
 
 
06e9d12
8dc54dd
 
 
7c2f064
8dc54dd
 
 
667eb29
8dc54dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

# Install basic dependencies
RUN apt-get update && apt-get install -y \
    wget \
    git \
    python3 \
    python3-pip \
    ffmpeg \
    libsm6 \
    libxext6 \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -m -s /bin/bash huggingface
WORKDIR /home/huggingface

# Set up git config
RUN git config --global user.email "[email protected]" && \
    git config --global user.name "jmanhype"

# Copy application code
COPY . /home/huggingface/app/
WORKDIR /home/huggingface/app

# Install Python dependencies
RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
RUN pip3 install --no-cache-dir -r requirements.txt
RUN pip3 install --no-cache-dir gradio spaces

# Install additional dependencies for controlnet_aux
RUN pip3 install --no-cache-dir openmim && \
    mim install mmcv>=2.0.1 && \
    mim install mmdet>=3.1.0 && \
    mim install mmpose>=1.1.0

# Set Python path
ENV PYTHONPATH=/home/huggingface/app:/home/huggingface/app/MMCM:/home/huggingface/app/diffusers/src:/home/huggingface/app/controlnet_aux/src

# Set ownership
RUN chown -R huggingface:huggingface /home/huggingface

# Switch to non-root user
USER huggingface

# Expose port
EXPOSE 7860

# Run the app
CMD ["python3", "scripts/gradio/app_gradio_space.py"]