ProductPlacement / Dockerfile
Ashoka74's picture
Upload folder using huggingface_hub
7087aed verified
raw
history blame
1.38 kB
# Start from NVIDIA CUDA base image
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV TORCH_HOME=/app/models
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
git \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip3 install --no-cache-dir torch==2.4.0+cu121 torchvision==0.19.1+cu121 --index-url https://download.pytorch.org/whl/cu121
RUN pip3 install --no-cache-dir -r requirements.txt
# Create models directory
RUN mkdir -p /app/models /app/outputs
# Copy application files
COPY . .
# Download model weights if needed
RUN mkdir -p /app/models && \
if [ ! -f /app/models/iclight_sd15_fc.safetensors ]; then \
wget -P /app/models https://huggingface.co/lllyasviel/ic-light/resolve/main/iclight_sd15_fc.safetensors; \
fi && \
if [ ! -f /app/models/iclight_sd15_fbc.safetensors ]; then \
wget -P /app/models https://huggingface.co/lllyasviel/ic-light/resolve/main/iclight_sd15_fbc.safetensors; \
fi
# Expose port for Gradio
EXPOSE 7860
# Command to run the application
CMD ["python3", "gradio_demo.py"]