Sticker_Diffusion / Dockerfile
KarthikAI's picture
Update Dockerfile
42a9c43 verified
raw
history blame
1.46 kB
FROM python:3.10-slim
# System dependencies
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Install Python dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Download models and adapters at build time
# You can replace MODEL_ID or adapter repos as needed
ENV CACHE_DIR="/data"
# ENV TRANSFORMERS_CACHE="/data"
# ENV DEEPFACE_HOME="/data"
# ENV INSIGHTFACE_HOME="/data/.insightface"
RUN mkdir -p /data && \
chmod -R 777 /data
# -- Download Stable Diffusion v1-5 weights --
# RUN python -c "from diffusers import StableDiffusionImg2ImgPipeline; StableDiffusionImg2ImgPipeline.from_pretrained('runwayml/stable-diffusion-v1-5', cache_dir='./models', torch_dtype='float32')"
RUN python -c "import torch; from diffusers import StableDiffusionImg2ImgPipeline; StableDiffusionImg2ImgPipeline.from_pretrained('runwayml/stable-diffusion-v1-5', cache_dir='./models', torch_dtype=torch.float32)"
RUN apt-get update && apt-get install -y wget
# -- Download IP-Adapter weights (official Hugging Face repo) --
RUN mkdir -p ./models/ip_adapter && \
wget -O ./models/ip_adapter/ip-adapter_sd15.bin https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15.bin
# Copy app code
COPY . .
# Set environment (disable gradio analytics, useful for Spaces)
ENV GRADIO_ANALYTICS_ENABLED="False"
EXPOSE 7860
CMD ["python", "app.py"]