mirror of
https://github.com/s0md3v/roop.git
synced 2025-12-06 18:08:29 +00:00
Fix potential exception
This commit is contained in:
parent
f9e663ecac
commit
3a32942dce
@ -30,10 +30,12 @@ def clear_face_analyser() -> Any:
|
||||
|
||||
def get_one_face(frame: Frame, position: int = 0) -> Optional[Face]:
|
||||
faces = get_many_faces(frame)
|
||||
try:
|
||||
return faces[position]
|
||||
except IndexError:
|
||||
return faces[-1]
|
||||
if faces:
|
||||
try:
|
||||
return faces[position]
|
||||
except IndexError:
|
||||
return faces[-1]
|
||||
return None
|
||||
|
||||
|
||||
def get_many_faces(frame: Frame) -> Optional[List[Face]]:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user