From de20c0044a0e48a281a6b28536e6ba63c6b8c9fc Mon Sep 17 00:00:00 2001 From: Sostenes Apollo Date: Tue, 13 Aug 2024 13:25:25 -0300 Subject: [PATCH] Using docker --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 15 +++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7de1e47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# Use NVIDIA CUDA base image +FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive +ENV PYTHONUNBUFFERED=1 + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + python3.10-tk \ + python3-pip \ + git \ + ffmpeg \ + libsm6 \ + libxext6 \ + libgl1-mesa-glx \ + wget \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Clone the repository +RUN git clone https://github.com/hacksider/Deep-Live-Cam.git . + +# Install Python dependencies +RUN pip3 install --no-cache-dir -r requirements.txt + +# Install ONNX Runtime GPU +RUN pip3 uninstall -y onnxruntime onnxruntime-gpu && \ + pip3 install --no-cache-dir onnxruntime-gpu==1.16.3 + +# Download required models +RUN mkdir -p models && \ + wget -O models/GFPGANv1.4.pth https://huggingface.co/hacksider/deep-live-cam/resolve/main/GFPGANv1.4.pth && \ + wget -O models/inswapper_128_fp16.onnx https://huggingface.co/hacksider/deep-live-cam/resolve/main/inswapper_128_fp16.onnx + +# Set the entrypoint +ENTRYPOINT ["python3", "run.py", "--execution-provider", "cuda"] + +# Default command (can be overridden) +CMD ["--help"] \ No newline at end of file diff --git a/README.md b/README.md index d8e004f..0909ecb 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,21 @@ The developers of this software are aware of its possible unethical applications Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users. +### Run using Docker: +``` +# Build +docker build -t deep-live-cam . + +# Run +docker run --gpus all \ + -v ./input:/app/input \ + -v ./output:/app/output \ + deep-live-cam \ + -s input/face.jpg \ + -t input/video.mp4\ + -o output +``` + ## How do I install it?