Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hacksider committed Nov 17, 2024
2 parents b9c7c0d + cab8b9a commit 9e54465
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
12 changes: 1 addition & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
[Remove this]The issue would most likely be diagnosed if you follow the template and give all the info.
***[Remove this]The issue would be closed without notice and be considered spam if the template is not followed.***

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
Real-time face swap and video deepfake with a single click and only a single image.
</p>

<p align="center">
<a href="https://trendshift.io/repositories/11395" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11395" alt="hacksider%2FDeep-Live-Cam | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
</p>

<p align="center">
<img src="media/demo.gif" alt="Demo GIF">
<img src="media/avgpcperformancedemo.gif" alt="Performance Demo GIF">
</p>


## Disclaimer

This software is intended as a productive contribution to the AI-generated media industry. It aims to assist artists with tasks like animating custom characters or using them as models for clothing, etc.
Expand Down
11 changes: 4 additions & 7 deletions modules/processors/frame/face_enhancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from modules.typing import Frame, Face
from modules.utilities import (
conditional_download,
resolve_relative_path,
is_image,
is_video,
)
Expand All @@ -21,9 +20,11 @@
THREAD_LOCK = threading.Lock()
NAME = "DLC.FACE-ENHANCER"

abs_dir = os.path.dirname(os.path.abspath(__file__))
models_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(abs_dir))), 'models')

def pre_check() -> bool:
download_directory_path = resolve_relative_path("..\models")
download_directory_path = models_dir
conditional_download(
download_directory_path,
[
Expand All @@ -47,11 +48,7 @@ def get_face_enhancer() -> Any:

with THREAD_LOCK:
if FACE_ENHANCER is None:
if os.name == "nt":
model_path = resolve_relative_path("..\models\GFPGANv1.4.pth")
# todo: set models path https://github.com/TencentARC/GFPGAN/issues/399
else:
model_path = resolve_relative_path("../models/GFPGANv1.4.pth")
model_path = os.path.join(models_dir, 'GFPGANv1.4.pth')
FACE_ENHANCER = gfpgan.GFPGANer(model_path=model_path, upscale=1) # type: ignore[attr-defined]
return FACE_ENHANCER

Expand Down
8 changes: 5 additions & 3 deletions modules/processors/frame/face_swapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
from modules.typing import Face, Frame
from modules.utilities import (
conditional_download,
resolve_relative_path,
is_image,
is_video,
)
from modules.cluster_analysis import find_closest_centroid
import os

FACE_SWAPPER = None
THREAD_LOCK = threading.Lock()
NAME = "DLC.FACE-SWAPPER"

abs_dir = os.path.dirname(os.path.abspath(__file__))
models_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(abs_dir))), 'models')

def pre_check() -> bool:
download_directory_path = resolve_relative_path("../models")
download_directory_path = abs_dir
conditional_download(
download_directory_path,
[
Expand Down Expand Up @@ -54,7 +56,7 @@ def get_face_swapper() -> Any:

with THREAD_LOCK:
if FACE_SWAPPER is None:
model_path = resolve_relative_path("../models/inswapper_128_fp16.onnx")
model_path = os.path.join(models_dir, 'inswapper_128_fp16.onnx')
FACE_SWAPPER = insightface.model_zoo.get_model(
model_path, providers=modules.globals.execution_providers
)
Expand Down

0 comments on commit 9e54465

Please sign in to comment.