mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2026-06-06 12:33:54 +02:00
Happy 80k!
2.1 Released! - Face randomizer added!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<h1 align="center">Deep-Live-Cam 2.0.5c</h1>
|
||||
<h1 align="center">Deep-Live-Cam 2.1</h1>
|
||||
|
||||
<p align="center">
|
||||
Real-time face swap and video deepfake with a single click and only a single image.
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
name = 'Deep-Live-Cam'
|
||||
version = '2.0.3c'
|
||||
version = '2.1'
|
||||
edition = 'GitHub Edition'
|
||||
+29
-1
@@ -10,6 +10,8 @@ import json
|
||||
import queue
|
||||
import threading
|
||||
import numpy as np
|
||||
import requests
|
||||
import tempfile
|
||||
import modules.globals
|
||||
import modules.metadata
|
||||
from modules.face_analyser import (
|
||||
@@ -192,9 +194,15 @@ 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.place(relx=0.1, rely=0.30, relwidth=0.3, relheight=0.1)
|
||||
select_face_button.place(relx=0.1, rely=0.30, relwidth=0.24, relheight=0.1)
|
||||
ToolTip(select_face_button, _("Choose the source face image to swap onto the target"))
|
||||
|
||||
random_face_button = ctk.CTkButton(
|
||||
root, text="🔄", cursor="hand2", width=30, command=lambda: fetch_random_face()
|
||||
)
|
||||
random_face_button.place(relx=0.35, rely=0.30, relwidth=0.05, relheight=0.1)
|
||||
ToolTip(random_face_button, _("Get a random face from thispersondoesnotexist.com"))
|
||||
|
||||
swap_faces_button = ctk.CTkButton(
|
||||
root, text="↔", cursor="hand2", command=lambda: swap_faces_paths()
|
||||
)
|
||||
@@ -766,6 +774,26 @@ def update_tumbler(var: str, value: bool) -> None:
|
||||
)
|
||||
|
||||
|
||||
def fetch_random_face() -> None:
|
||||
PREVIEW.withdraw()
|
||||
try:
|
||||
response = requests.get(
|
||||
"https://thispersondoesnotexist.com/",
|
||||
headers={"User-Agent": "Mozilla/5.0"},
|
||||
timeout=10,
|
||||
)
|
||||
response.raise_for_status()
|
||||
temp_dir = tempfile.gettempdir()
|
||||
temp_path = os.path.join(temp_dir, "deep_live_cam_random_face.jpg")
|
||||
with open(temp_path, "wb") as f:
|
||||
f.write(response.content)
|
||||
modules.globals.source_path = temp_path
|
||||
image = render_image_preview(temp_path, (200, 200))
|
||||
source_label.configure(image=image)
|
||||
except Exception as e:
|
||||
print(f"Failed to fetch random face: {e}")
|
||||
|
||||
|
||||
def select_source_path() -> None:
|
||||
global RECENT_DIRECTORY_SOURCE, img_ft, vid_ft
|
||||
|
||||
|
||||
Reference in New Issue
Block a user