def interactive_controlnet(
    config,
    context,
    menu_flag=False,
):
    """
    @param menu_flag: Indicates whether this function was called from the main
        interactive CLI menu; _True_ if called from the main menu, _False_ otherwise
    """
    settings = config.lcm_diffusion_setting
    if not settings.controlnet:
        settings.controlnet = ControlNetSetting()

    current_enabled = settings.controlnet.enabled
    current_adapter_path = settings.controlnet.adapter_path
    current_conditioning_scale = settings.controlnet.conditioning_scale
    current_control_image = settings.controlnet._control_image

    option = input("Enable ControlNet? (y/N): ")
    settings.controlnet.enabled = True if option.upper() == "Y" else False
    if settings.controlnet.enabled:
        option = input(
            f"Enter ControlNet adapter path ({settings.controlnet.adapter_path}): "
        )
        if option != "":
            settings.controlnet.adapter_path = option
        settings.controlnet.conditioning_scale = user_value(
            float,
            f"Enter ControlNet conditioning scale ({settings.controlnet.conditioning_scale}): ",
            settings.controlnet.conditioning_scale,
        )
        option = input(
            f"Enter ControlNet control image path (Leave empty to reuse current): "
        )
        if option != "":
            try:
                new_image = Image.open(option)
                settings.controlnet._control_image = new_image
            except (AttributeError, FileNotFoundError) as e:
                settings.controlnet._control_image = None
        if (
            not settings.controlnet.adapter_path
            or not path.exists(settings.controlnet.adapter_path)
            or not settings.controlnet._control_image
        ):
            print("Invalid ControlNet settings! Disabling ControlNet")
            settings.controlnet.enabled = False

    if (
        settings.controlnet.enabled != current_enabled
        or settings.controlnet.adapter_path != current_adapter_path
    ):
        settings.rebuild_pipeline = True

    @param menu_flag: Indicates whether this function was called from the main
        interactive CLI menu; _True_ if called from the main menu, _False_ otherwise
    
src/frontend/cli_interactive.py