Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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
Expand Down
17 changes: 7 additions & 10 deletions modules/processors/frame/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Avoid bare except usage.

Specify the exception types or log the error to avoid hiding issues and aid debugging.

Suggested implementation:

        except Exception as e:
            import logging  # Ensure logging is imported at the top if not already
            logging.exception(f"Error while loading frame processor module '{frame_processor}': {e}")

Make sure to remove any duplicate import of logging if it already exists at the top of the file.

with ThreadPoolExecutor(max_workers=modules.globals.execution_threads) as executor:
Expand Down
10 changes: 0 additions & 10 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -1003,7 +994,6 @@ def on_clear_click():
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

Expand Down