fix: Update type hints for Python 3.9 compatibility

Replaces Python 3.10+ type hint syntax (e.g., Frame | None)
with Python 3.9 compatible syntax (e.g., Optional[Frame])
in modules/processors/frame/face_swapper.py.

This resolves a TypeError encountered when running on Python 3.9.
Specifically, the return type of _prepare_warped_source_material_and_mask
was updated.
pull/1313/head
google-labs-jules[bot] 2025-05-25 18:10:43 +00:00
parent 3d8af5180d
commit 521cad145d
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
from typing import Any, List
from typing import Any, List, Optional, Tuple
import cv2
import insightface
import threading
@ -72,8 +72,8 @@ def _prepare_warped_source_material_and_mask(
source_face_obj: Face,
source_frame_full: Frame,
matrix: np.ndarray,
dsize: tuple
) -> tuple[Frame | None, Frame | None]:
dsize: tuple # Built-in tuple is fine here for parameter type
) -> Tuple[Optional[Frame], Optional[Frame]]:
"""
Prepares warped source material (full image) and a combined (face+hair) mask for blending.
Returns (None, None) if essential masks cannot be generated.