code: def create_image_conditional_figure(
      query_image: np.ndarray,
      target_image: np.ndarray,
      target_boxes: np.ndarray,
      fig_size: int = 600,
  ) -> layouts.LayoutDOM:
      """Creates a Bokeh figure for interactive image-conditional detection.
  
      Args:
        query_image: Image from which the query box will be selected.
        target_image: Image in which to detect objects.
        target_boxes: Predicted boxes for the target image ([cx, cy, w, h] format).
        fig_size: Size of the Bokeh figure in pixels.
  
      Returns:
        The Bokeh layout of the figure.
      """
      source_plot = _create_image_figure(
          query_image, fig_size, title="Query image", tools="box_select"
      )
      target_plot = _create_image_figure(
          target_image, fig_size, title="Target image"
      )
      pred_box_data_source = _plot_boxes(target_plot, target_boxes)
  
      # Source selection code:
      user_query_rect = models.Rect(
          x="x",
          y="y",
          width="width",
          height="height",
          line_color="#00ff00",
          line_width=3,
          fill_alpha=0.1,
          fill_color="#00ff00",
      )
      user_query_box_data_source = models.ColumnDataSource(
          data=dict(x=(-1,), y=(-1,), width=(0,), height=(0,))
      )
      source_plot.add_glyph(
          user_query_box_data_source,
          user_query_rect,
          selection_glyph=user_query_rect,
          nonselection_glyph=user_query_rect,
      )
      model_query_rect = models.Rect(
          x="x",
          y="y",
          width="width",
          height="height",
          line_color="#ff0000",
          line_width=3,
          fill_alpha=0.1,
          fill_color="#ff0000",
      )
      model_query_box_data_source = models.ColumnDataSource(
          data=dict(x=(-1,), y=(-1,), width=(0,), height=(0,))
      )
      source_plot.add_glyph(
          model_query_box_data_source,
          model_query_rect,
          selection_glyph=model_query_rect,
          nonselection_glyph=model_query_rect,
      )
  
      # Register box selection callback:
      callback = interactive.get_image_conditioning_js_callback(
          user_query_box_data_source=user_query_box_data_source,
          model_query_box_data_source=model_query_box_data_source,
          pred_box_data_source=pred_box_data_source,
      )
      source_plot.js_on_event(events.SelectionGeometry, callback)
  
      layout = layouts.row(source_plot, target_plot)
      plotting.show(layout)
  
      return layout
  
file_path: scenic/scenic/projects/owl_vit/notebooks/plotting.py
imports: import bokeh
  from bokeh import events
  from bokeh import layouts
  from bokeh import models
  from bokeh import plotting
  from bokeh.models import widgets
  import numpy
  from scenic.model_lib.base_models import box_utils
  from scenic.projects.owl_vit.notebooks import interactive
label_desc: Use image node_id 2 for calling a global function with example usage: create_image_conditional_figure(query_image, target_image, target_boxes, fig_size) and returns: layout