def attach_load_events(self, rendered_in: Renderable | None = None):
        """Add a load event for every component whose initial value requires a function call to set."""
        for component in self.blocks.values():
            if rendered_in is not None and component.rendered_in != rendered_in:
                continue
            if (
                isinstance(component, components.Component)
                and component.load_event_to_attach
            ):
                load_fn, triggers, inputs = component.load_event_to_attach
                has_target = len(triggers) > 0
                triggers += [(self.root_block, "load")]
                # Use set_event_trigger to avoid ambiguity between load class/instance method

                dep = self.set_event_trigger(
                    [EventListenerMethod(*trigger) for trigger in triggers],
                    load_fn,
                    inputs,
                    component,
                    no_target=not has_target,
                    show_progress="hidden" if has_target else "full",
                )[0]
                component.load_event = dep.get_config()
Add a load event for every component whose initial value requires a function call to set.
gradio/blocks.py