Skip to content

Commit

Permalink
Refresh reference face position
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Aug 11, 2023
1 parent 6f99280 commit e041759
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions roop/uis/__components__/face_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def listen() -> None:
FACE_ANALYSER_DIRECTION_DROPDOWN.select(lambda value: update_dropdown('face_analyser_direction', value), inputs=FACE_ANALYSER_DIRECTION_DROPDOWN, outputs=FACE_ANALYSER_DIRECTION_DROPDOWN)
FACE_ANALYSER_AGE_DROPDOWN.select(lambda value: update_dropdown('face_analyser_age', value), inputs=FACE_ANALYSER_AGE_DROPDOWN, outputs=FACE_ANALYSER_AGE_DROPDOWN)
FACE_ANALYSER_GENDER_DROPDOWN.select(lambda value: update_dropdown('face_analyser_gender', value), inputs=FACE_ANALYSER_GENDER_DROPDOWN, outputs=FACE_ANALYSER_GENDER_DROPDOWN)
FACE_ANALYSER_DIRECTION_DROPDOWN.select(update_face_reference_position, outputs=REFERENCE_FACE_POSITION_GALLERY)
FACE_ANALYSER_AGE_DROPDOWN.select(update_face_reference_position, outputs=REFERENCE_FACE_POSITION_GALLERY)
FACE_ANALYSER_GENDER_DROPDOWN.select(update_face_reference_position, outputs=REFERENCE_FACE_POSITION_GALLERY)


def update_face_recognition(face_recognition: FaceRecognition) -> Tuple[Update, Update]:
Expand Down
20 changes: 12 additions & 8 deletions roop/uis/__components__/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,27 @@ def render() -> None:

def listen() -> None:
PREVIEW_FRAME_SLIDER.change(update, inputs=PREVIEW_FRAME_SLIDER, outputs=[PREVIEW_IMAGE, PREVIEW_FRAME_SLIDER])
component_names: List[ComponentName] = [
update_component_names: List[ComponentName] = [
'source_file',
'target_file',
'face_recognition_dropdown',
'reference_face_distance_slider',
'face_analyser_direction_dropdown',
'face_analyser_age_dropdown',
'face_analyser_gender_dropdown',
'frame_processors_checkbox_group'
]
for component_name in component_names:
for component_name in update_component_names:
component = ui.get_component(component_name)
if component:
component.change(update, inputs=PREVIEW_FRAME_SLIDER, outputs=[PREVIEW_IMAGE, PREVIEW_FRAME_SLIDER])
reference_face_position_gallery = ui.get_component('reference_face_position_gallery')
if reference_face_position_gallery:
reference_face_position_gallery.select(update, inputs=PREVIEW_FRAME_SLIDER, outputs=[PREVIEW_IMAGE, PREVIEW_FRAME_SLIDER])
select_component_names: List[ComponentName] = [
'reference_face_position_gallery',
'face_analyser_direction_dropdown',
'face_analyser_age_dropdown',
'face_analyser_gender_dropdown'
]
for component_name in select_component_names:
component = ui.get_component(component_name)
if component:
component.select(update, inputs=PREVIEW_FRAME_SLIDER, outputs=[PREVIEW_IMAGE, PREVIEW_FRAME_SLIDER])


def update(frame_number: int = 0) -> Tuple[Update, Update]:
Expand Down

0 comments on commit e041759

Please sign in to comment.