Fixed 0 Transparency
The error was caused by an erroneous designation of "face_swapper_enabled" in lieu of "fp_ui."pull/894/head
parent
9af216e819
commit
5dd6d1fe64
|
@ -14,6 +14,7 @@ from modules.utilities import (
|
||||||
is_video,
|
is_video,
|
||||||
)
|
)
|
||||||
from modules.cluster_analysis import find_closest_centroid
|
from modules.cluster_analysis import find_closest_centroid
|
||||||
|
from modules.globals import face_swapper_enabled, opacity
|
||||||
import os
|
import os
|
||||||
|
|
||||||
FACE_SWAPPER = None
|
FACE_SWAPPER = None
|
||||||
|
@ -100,12 +101,12 @@ def swap_face(source_face: Face, target_face: Face, temp_frame: Frame) -> Frame:
|
||||||
|
|
||||||
|
|
||||||
def process_frame(source_face: Face, temp_frame: Frame) -> Frame:
|
def process_frame(source_face: Face, temp_frame: Frame) -> Frame:
|
||||||
|
if getattr(modules.globals, "opacity", 1.0) == 0:
|
||||||
|
return temp_frame
|
||||||
|
|
||||||
if modules.globals.color_correction:
|
if modules.globals.color_correction:
|
||||||
temp_frame = cv2.cvtColor(temp_frame, cv2.COLOR_BGR2RGB)
|
temp_frame = cv2.cvtColor(temp_frame, cv2.COLOR_BGR2RGB)
|
||||||
|
|
||||||
if modules.globals.opacity or modules.globals.face_swapper_enabled == 0:
|
|
||||||
return temp_frame
|
|
||||||
|
|
||||||
if modules.globals.many_faces:
|
if modules.globals.many_faces:
|
||||||
many_faces = get_many_faces(temp_frame)
|
many_faces = get_many_faces(temp_frame)
|
||||||
if many_faces:
|
if many_faces:
|
||||||
|
@ -119,6 +120,9 @@ def process_frame(source_face: Face, temp_frame: Frame) -> Frame:
|
||||||
|
|
||||||
|
|
||||||
def process_frame_v2(temp_frame: Frame, temp_frame_path: str = "") -> Frame:
|
def process_frame_v2(temp_frame: Frame, temp_frame_path: str = "") -> Frame:
|
||||||
|
if getattr(modules.globals, "opacity", 1.0) == 0:
|
||||||
|
return temp_frame
|
||||||
|
|
||||||
if is_image(modules.globals.target_path):
|
if is_image(modules.globals.target_path):
|
||||||
if modules.globals.many_faces:
|
if modules.globals.many_faces:
|
||||||
source_face = default_source_face()
|
source_face = default_source_face()
|
||||||
|
|
|
@ -27,6 +27,7 @@ from modules.utilities import (
|
||||||
)
|
)
|
||||||
from modules.video_capture import VideoCapturer
|
from modules.video_capture import VideoCapturer
|
||||||
from modules.gettext import LanguageManager
|
from modules.gettext import LanguageManager
|
||||||
|
from modules import globals
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
@ -183,7 +184,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
modules.globals.opacity = percentage / 100.0
|
modules.globals.opacity = percentage / 100.0
|
||||||
|
|
||||||
if percentage == 0:
|
if percentage == 0:
|
||||||
modules.globals.face_swapper_enabled = False
|
modules.globals.fp_ui["face_enhancer"] = False
|
||||||
update_status("Transparency set to 0% - Face swapping disabled.")
|
update_status("Transparency set to 0% - Face swapping disabled.")
|
||||||
elif percentage == 100:
|
elif percentage == 100:
|
||||||
modules.globals.face_swapper_enabled = True
|
modules.globals.face_swapper_enabled = True
|
||||||
|
|
Loading…
Reference in New Issue