diff --git a/facefusion/face_selector.py b/facefusion/face_selector.py index 12225e46..971f8072 100644 --- a/facefusion/face_selector.py +++ b/facefusion/face_selector.py @@ -14,8 +14,7 @@ def select_faces(reference_vision_frame : VisionFrame, source_vision_frames : Li source_faces = get_static_faces(source_vision_frames) target_faces = get_many_faces([ target_vision_frame ]) - if state_manager.get_item('face_stabilizer'): - target_faces = stabilize_faces(target_faces, (target_vision_frame.shape[1], target_vision_frame.shape[0]), state_manager.get_item('face_stabilizer_smoothness')) + target_faces = stabilize_faces(target_faces, (target_vision_frame.shape[1], target_vision_frame.shape[0]), state_manager.get_item('face_stabilizer_smoothness')) if state_manager.get_item('face_selector_mode') == 'many': return sort_and_filter_faces(source_faces, target_faces) diff --git a/facefusion/locales.py b/facefusion/locales.py index 612d59ea..6af4826f 100644 --- a/facefusion/locales.py +++ b/facefusion/locales.py @@ -262,7 +262,6 @@ LOCALES : Locales =\ 'trim_frame_slider': 'TRIM FRAME', 'ui_workflow': 'UI WORKFLOW', 'video_memory_strategy_dropdown': 'VIDEO MEMORY STRATEGY', - 'webcam_face_stabilizer_checkbox': 'WEBCAM FACE STABILIZER', 'webcam_face_stabilizer_smoothness_slider': 'WEBCAM FACE STABILIZER SMOOTHNESS', 'webcam_fps_slider': 'WEBCAM FPS', 'webcam_image': 'WEBCAM', diff --git a/facefusion/types.py b/facefusion/types.py index e3587327..af7d0988 100755 --- a/facefusion/types.py +++ b/facefusion/types.py @@ -302,7 +302,6 @@ StateKey = Literal\ 'face_mask_regions', 'face_mask_blur', 'face_mask_padding', - 'face_stabilizer', 'face_stabilizer_smoothness', 'voice_extractor_model', 'trim_frame_start', @@ -373,7 +372,6 @@ State = TypedDict('State', 'face_mask_regions' : List[FaceMaskRegion], 'face_mask_blur' : float, 'face_mask_padding' : Padding, - 'face_stabilizer' : bool, 'face_stabilizer_smoothness' : float, 'voice_extractor_model' : VoiceExtractorModel, 'trim_frame_start' : int, diff --git a/facefusion/uis/components/webcam.py b/facefusion/uis/components/webcam.py index 40deeddd..7dcf65a9 100644 --- a/facefusion/uis/components/webcam.py +++ b/facefusion/uis/components/webcam.py @@ -53,12 +53,11 @@ def listen() -> None: webcam_mode_radio = get_ui_component('webcam_mode_radio') webcam_resolution_dropdown = get_ui_component('webcam_resolution_dropdown') webcam_fps_slider = get_ui_component('webcam_fps_slider') - webcam_face_stabilizer_checkbox = get_ui_component('webcam_face_stabilizer_checkbox') webcam_face_stabilizer_smoothness_slider = get_ui_component('webcam_face_stabilizer_smoothness_slider') - if webcam_device_id_dropdown and webcam_mode_radio and webcam_resolution_dropdown and webcam_fps_slider and webcam_face_stabilizer_checkbox and webcam_face_stabilizer_smoothness_slider: + if webcam_device_id_dropdown and webcam_mode_radio and webcam_resolution_dropdown and webcam_fps_slider and webcam_face_stabilizer_smoothness_slider: WEBCAM_START_BUTTON.click(pre_start, outputs = [ SOURCE_FILE, WEBCAM_IMAGE, WEBCAM_START_BUTTON, WEBCAM_STOP_BUTTON ]) - start_event = WEBCAM_START_BUTTON.click(start, inputs = [ webcam_device_id_dropdown, webcam_mode_radio, webcam_resolution_dropdown, webcam_fps_slider, webcam_face_stabilizer_checkbox, webcam_face_stabilizer_smoothness_slider ], outputs = WEBCAM_IMAGE) + start_event = WEBCAM_START_BUTTON.click(start, inputs = [ webcam_device_id_dropdown, webcam_mode_radio, webcam_resolution_dropdown, webcam_fps_slider, webcam_face_stabilizer_smoothness_slider ], outputs = WEBCAM_IMAGE) start_event.then(pre_stop) WEBCAM_STOP_BUTTON.click(stop, cancels = start_event, outputs = WEBCAM_IMAGE) WEBCAM_STOP_BUTTON.click(pre_stop, outputs = [ SOURCE_FILE, WEBCAM_IMAGE, WEBCAM_START_BUTTON, WEBCAM_STOP_BUTTON ]) @@ -84,9 +83,8 @@ def pre_stop() -> Tuple[gradio.File, gradio.Image, gradio.Button, gradio.Button] return gradio.File(visible = True), gradio.Image(visible = False), gradio.Button(visible = True), gradio.Button(visible = False) -def start(webcam_device_id : int, webcam_mode : WebcamMode, webcam_resolution : str, webcam_fps : Fps, webcam_face_stabilizer : bool, webcam_face_stabilizer_smoothness : float) -> Iterator[VisionFrame]: +def start(webcam_device_id : int, webcam_mode : WebcamMode, webcam_resolution : str, webcam_fps : Fps, webcam_face_stabilizer_smoothness : float) -> Iterator[VisionFrame]: state_manager.init_item('face_selector_mode', 'one') - state_manager.init_item('face_stabilizer', webcam_face_stabilizer) state_manager.init_item('face_stabilizer_smoothness', webcam_face_stabilizer_smoothness) state_manager.sync_state() diff --git a/facefusion/uis/components/webcam_options.py b/facefusion/uis/components/webcam_options.py index 7d9f4527..46992678 100644 --- a/facefusion/uis/components/webcam_options.py +++ b/facefusion/uis/components/webcam_options.py @@ -12,7 +12,6 @@ WEBCAM_DEVICE_ID_DROPDOWN : Optional[gradio.Dropdown] = None WEBCAM_MODE_RADIO : Optional[gradio.Radio] = None WEBCAM_RESOLUTION_DROPDOWN : Optional[gradio.Dropdown] = None WEBCAM_FPS_SLIDER : Optional[gradio.Slider] = None -WEBCAM_FACE_STABILIZER_CHECKBOX : Optional[gradio.Checkbox] = None WEBCAM_FACE_STABILIZER_SMOOTHNESS_SLIDER : Optional[gradio.Slider] = None @@ -21,7 +20,6 @@ def render() -> None: global WEBCAM_MODE_RADIO global WEBCAM_RESOLUTION_DROPDOWN global WEBCAM_FPS_SLIDER - global WEBCAM_FACE_STABILIZER_CHECKBOX global WEBCAM_FACE_STABILIZER_SMOOTHNESS_SLIDER local_camera_ids = detect_local_camera_ids(0, 10) or [ 'none' ] #type:ignore[list-item] @@ -47,10 +45,6 @@ def render() -> None: minimum = 1, maximum = 30 ) - WEBCAM_FACE_STABILIZER_CHECKBOX = gradio.Checkbox( - label = translator.get('uis.webcam_face_stabilizer_checkbox'), - value = False - ) WEBCAM_FACE_STABILIZER_SMOOTHNESS_SLIDER = gradio.Slider( label = translator.get('uis.webcam_face_stabilizer_smoothness_slider'), value = 1.0, @@ -62,5 +56,4 @@ def render() -> None: register_ui_component('webcam_mode_radio', WEBCAM_MODE_RADIO) register_ui_component('webcam_resolution_dropdown', WEBCAM_RESOLUTION_DROPDOWN) register_ui_component('webcam_fps_slider', WEBCAM_FPS_SLIDER) - register_ui_component('webcam_face_stabilizer_checkbox', WEBCAM_FACE_STABILIZER_CHECKBOX) register_ui_component('webcam_face_stabilizer_smoothness_slider', WEBCAM_FACE_STABILIZER_SMOOTHNESS_SLIDER)