Compare commits
5 Commits
ce5b3910d7
...
fd6629895e
Author | SHA1 | Date |
---|---|---|
|
fd6629895e | |
|
40598daea9 | |
|
528c30e3ba | |
|
fb1f559c4d | |
|
de20c0044a |
|
@ -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"]
|
15
README.md
15
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 by local laws. If the face of a real person is being used, users are required 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.
|
Users of this software are expected to use this software responsibly while abiding by local laws. If the face of a real person is being used, users are required 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 # Source image for face swapping
|
||||||
|
-t input/video.mp4 # Target video to apply face swap
|
||||||
|
-o output # Output directory for results
|
||||||
|
```
|
||||||
|
|
||||||
## How do I install it?
|
## How do I install it?
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,9 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
select_face_button = ctk.CTkButton(root, text='Select a face', cursor='hand2', command=lambda: select_source_path())
|
select_face_button = ctk.CTkButton(root, text='Select a face', cursor='hand2', command=lambda: select_source_path())
|
||||||
select_face_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
|
select_face_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
|
||||||
|
|
||||||
|
swap_faces_button = ctk.CTkButton(root, text='↔', cursor='hand2', command=lambda: swap_faces_paths())
|
||||||
|
swap_faces_button.place(relx=0.45, rely=0.4, relwidth=0.1, relheight=0.1)
|
||||||
|
|
||||||
select_target_button = ctk.CTkButton(root, text='Select a target', cursor='hand2', command=lambda: select_target_path())
|
select_target_button = ctk.CTkButton(root, text='Select a target', cursor='hand2', command=lambda: select_target_path())
|
||||||
select_target_button.place(relx=0.6, rely=0.4, relwidth=0.3, relheight=0.1)
|
select_target_button.place(relx=0.6, rely=0.4, relwidth=0.3, relheight=0.1)
|
||||||
|
|
||||||
|
@ -159,6 +162,30 @@ def select_source_path() -> None:
|
||||||
source_label.configure(image=None)
|
source_label.configure(image=None)
|
||||||
|
|
||||||
|
|
||||||
|
def swap_faces_paths() -> None:
|
||||||
|
global RECENT_DIRECTORY_SOURCE, RECENT_DIRECTORY_TARGET
|
||||||
|
|
||||||
|
source_path = modules.globals.source_path
|
||||||
|
target_path = modules.globals.target_path
|
||||||
|
|
||||||
|
if not is_image(source_path) or not is_image(target_path):
|
||||||
|
return
|
||||||
|
|
||||||
|
modules.globals.source_path = target_path
|
||||||
|
modules.globals.target_path = source_path
|
||||||
|
|
||||||
|
RECENT_DIRECTORY_SOURCE = os.path.dirname(modules.globals.source_path)
|
||||||
|
RECENT_DIRECTORY_TARGET = os.path.dirname(modules.globals.target_path)
|
||||||
|
|
||||||
|
PREVIEW.withdraw()
|
||||||
|
|
||||||
|
source_image = render_image_preview(modules.globals.source_path, (200, 200))
|
||||||
|
source_label.configure(image=source_image)
|
||||||
|
|
||||||
|
target_image = render_image_preview(modules.globals.target_path, (200, 200))
|
||||||
|
target_label.configure(image=target_image)
|
||||||
|
|
||||||
|
|
||||||
def select_target_path() -> None:
|
def select_target_path() -> None:
|
||||||
global RECENT_DIRECTORY_TARGET, img_ft, vid_ft
|
global RECENT_DIRECTORY_TARGET, img_ft, vid_ft
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue