Switch order of frame colorizer options

This commit is contained in:
henryruhs 2024-09-28 10:40:01 +02:00
parent 70d97e6806
commit 0a24fc72b4
4 changed files with 19 additions and 16 deletions

View File

@ -75,8 +75,8 @@ face_enhancer_blend =
face_swapper_model =
face_swapper_pixel_boost =
frame_colorizer_model =
frame_colorizer_blend =
frame_colorizer_size =
frame_colorizer_blend =
frame_enhancer_model =
frame_enhancer_blend =
lip_syncer_model =

View File

@ -143,8 +143,8 @@ def register_args(program : ArgumentParser) -> None:
group_processors = find_argument_group(program, 'processors')
if group_processors:
group_processors.add_argument('--frame-colorizer-model', help = wording.get('help.frame_colorizer_model'), default = config.get_str_value('processors.frame_colorizer_model', 'ddcolor'), choices = processors_choices.frame_colorizer_models)
group_processors.add_argument('--frame-colorizer-blend', help = wording.get('help.frame_colorizer_blend'), type = int, default = config.get_int_value('processors.frame_colorizer_blend', '100'), choices = processors_choices.frame_colorizer_blend_range, metavar = create_int_metavar(processors_choices.frame_colorizer_blend_range))
group_processors.add_argument('--frame-colorizer-size', help = wording.get('help.frame_colorizer_size'), type = str, default = config.get_str_value('processors.frame_colorizer_size', '256x256'), choices = processors_choices.frame_colorizer_sizes)
group_processors.add_argument('--frame-colorizer-blend', help = wording.get('help.frame_colorizer_blend'), type = int, default = config.get_int_value('processors.frame_colorizer_blend', '100'), choices = processors_choices.frame_colorizer_blend_range, metavar = create_int_metavar(processors_choices.frame_colorizer_blend_range))
facefusion.jobs.job_store.register_step_keys([ 'frame_colorizer_model', 'frame_colorizer_blend', 'frame_colorizer_size' ])

View File

@ -10,14 +10,14 @@ from facefusion.processors.typing import FrameColorizerModel
from facefusion.uis.core import get_ui_component, register_ui_component
FRAME_COLORIZER_MODEL_DROPDOWN : Optional[gradio.Dropdown] = None
FRAME_COLORIZER_BLEND_SLIDER : Optional[gradio.Slider] = None
FRAME_COLORIZER_SIZE_DROPDOWN : Optional[gradio.Dropdown] = None
FRAME_COLORIZER_BLEND_SLIDER : Optional[gradio.Slider] = None
def render() -> None:
global FRAME_COLORIZER_MODEL_DROPDOWN
global FRAME_COLORIZER_BLEND_SLIDER
global FRAME_COLORIZER_SIZE_DROPDOWN
global FRAME_COLORIZER_BLEND_SLIDER
FRAME_COLORIZER_MODEL_DROPDOWN = gradio.Dropdown(
label = wording.get('uis.frame_colorizer_model_dropdown'),
@ -25,6 +25,12 @@ def render() -> None:
value = state_manager.get_item('frame_colorizer_model'),
visible = 'frame_colorizer' in state_manager.get_item('processors')
)
FRAME_COLORIZER_SIZE_DROPDOWN = gradio.Dropdown(
label = wording.get('uis.frame_colorizer_size_dropdown'),
choices = processors_choices.frame_colorizer_sizes,
value = state_manager.get_item('frame_colorizer_size'),
visible = 'frame_colorizer' in state_manager.get_item('processors')
)
FRAME_COLORIZER_BLEND_SLIDER = gradio.Slider(
label = wording.get('uis.frame_colorizer_blend_slider'),
value = state_manager.get_item('frame_colorizer_blend'),
@ -33,21 +39,15 @@ def render() -> None:
maximum = processors_choices.frame_colorizer_blend_range[-1],
visible = 'frame_colorizer' in state_manager.get_item('processors')
)
FRAME_COLORIZER_SIZE_DROPDOWN = gradio.Dropdown(
label = wording.get('uis.frame_colorizer_size_dropdown'),
choices = processors_choices.frame_colorizer_sizes,
value = state_manager.get_item('frame_colorizer_size'),
visible = 'frame_colorizer' in state_manager.get_item('processors')
)
register_ui_component('frame_colorizer_model_dropdown', FRAME_COLORIZER_MODEL_DROPDOWN)
register_ui_component('frame_colorizer_blend_slider', FRAME_COLORIZER_BLEND_SLIDER)
register_ui_component('frame_colorizer_size_dropdown', FRAME_COLORIZER_SIZE_DROPDOWN)
register_ui_component('frame_colorizer_blend_slider', FRAME_COLORIZER_BLEND_SLIDER)
def listen() -> None:
FRAME_COLORIZER_MODEL_DROPDOWN.change(update_frame_colorizer_model, inputs = FRAME_COLORIZER_MODEL_DROPDOWN, outputs = FRAME_COLORIZER_MODEL_DROPDOWN)
FRAME_COLORIZER_BLEND_SLIDER.release(update_frame_colorizer_blend, inputs = FRAME_COLORIZER_BLEND_SLIDER)
FRAME_COLORIZER_SIZE_DROPDOWN.change(update_frame_colorizer_size, inputs = FRAME_COLORIZER_SIZE_DROPDOWN)
FRAME_COLORIZER_BLEND_SLIDER.release(update_frame_colorizer_blend, inputs = FRAME_COLORIZER_BLEND_SLIDER)
processors_checkbox_group = get_ui_component('processors_checkbox_group')
if processors_checkbox_group:
@ -69,9 +69,12 @@ def update_frame_colorizer_model(frame_colorizer_model : FrameColorizerModel) ->
return gradio.Dropdown()
def update_frame_colorizer_size(frame_colorizer_size : str) -> None:
state_manager.set_item('frame_colorizer_size', frame_colorizer_size)
def update_frame_colorizer_blend(frame_colorizer_blend : float) -> None:
state_manager.set_item('frame_colorizer_blend', int(frame_colorizer_blend))
def update_frame_colorizer_size(frame_colorizer_size : str) -> None:
state_manager.set_item('frame_colorizer_size', frame_colorizer_size)

View File

@ -100,7 +100,7 @@ WORDING : Dict[str, Any] =\
'output_path': 'specify the output image or video within a directory',
# face detector
'face_detector_model': 'choose the model responsible for detecting the faces',
'face_detector_size': 'specify the size of the frame provided to the face detector',
'face_detector_size': 'specify the frame size provided to the face detector',
'face_detector_angles': 'specify the angles to rotate the frame before detecting faces',
'face_detector_score': 'filter the detected faces base on the confidence score',
# face landmarker
@ -163,8 +163,8 @@ WORDING : Dict[str, Any] =\
'face_swapper_model': 'choose the model responsible for swapping the face',
'face_swapper_pixel_boost': 'choose the pixel boost resolution for the face swapper',
'frame_colorizer_model': 'choose the model responsible for colorizing the frame',
'frame_colorizer_size': 'specify the frame size provided to the frame colorizer',
'frame_colorizer_blend': 'blend the colorized into the previous frame',
'frame_colorizer_size': 'specify the size of the frame provided to the frame colorizer',
'frame_enhancer_model': 'choose the model responsible for enhancing the frame',
'frame_enhancer_blend': 'blend the enhanced into the previous frame',
'lip_syncer_model': 'choose the model responsible for syncing the lips',