diff --git a/modules/globals.py b/modules/globals.py index 564fe7d..3ed01c0 100644 --- a/modules/globals.py +++ b/modules/globals.py @@ -15,7 +15,7 @@ simple_map = {} source_path = None target_path = None output_path = None -frame_processors: List[str] = [] +frame_processors: List[str] = ["face_swapper"] keep_fps = True keep_audio = True keep_frames = False diff --git a/modules/processors/frame/core.py b/modules/processors/frame/core.py index 7d76704..31eb605 100644 --- a/modules/processors/frame/core.py +++ b/modules/processors/frame/core.py @@ -42,18 +42,15 @@ def get_frame_processors_modules(frame_processors: List[str]) -> List[ModuleType def set_frame_processors_modules_from_ui(frame_processors: List[str]) -> None: global FRAME_PROCESSORS_MODULES - for frame_processor, state in modules.globals.fp_ui.items(): - if state == True and frame_processor not in frame_processors: + # Clear existing modules + FRAME_PROCESSORS_MODULES = [] + # Only load modules that are explicitly requested + for frame_processor in frame_processors: + try: frame_processor_module = load_frame_processor_module(frame_processor) FRAME_PROCESSORS_MODULES.append(frame_processor_module) - modules.globals.frame_processors.append(frame_processor) - if state == False: - try: - frame_processor_module = load_frame_processor_module(frame_processor) - FRAME_PROCESSORS_MODULES.remove(frame_processor_module) - modules.globals.frame_processors.remove(frame_processor) - except: - pass + except: + pass def multi_process_frame(source_path: str, temp_frame_paths: List[str], process_frames: Callable[[str, List[str], Any], None], progress: Any = None) -> None: with ThreadPoolExecutor(max_workers=modules.globals.execution_threads) as executor: diff --git a/modules/ui.py b/modules/ui.py index 94fa5cf..d1e6a28 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -797,7 +797,6 @@ def webcam_preview(root: ctk.CTk, camera_index: int): ) - def get_available_cameras(): """Returns a list of available camera names and indices.""" if platform.system() == "Windows": @@ -845,14 +844,6 @@ def get_available_cameras(): camera_indices.append(0) camera_names.append("FaceTime Camera") cap.release() - - # On macOS, additional cameras typically use indices 1 and 2 - for i in [1, 2]: - cap = cv2.VideoCapture(i) - if cap.isOpened(): - camera_indices.append(i) - camera_names.append(f"Camera {i}") - cap.release() else: # Linux camera detection - test first 10 indices for i in range(10): @@ -1003,7 +994,6 @@ def create_source_target_popup_for_webcam( close_button.place(relx=0.7, rely=0.92, relwidth=0.2, relheight=0.05) - def clear_source_target_images(map: list): global source_label_dict_live, target_label_dict_live