# default_exp explore_annotator

Annotator ExplorerΒΆ

#export

class ExploreAnnotatorState(BaseState):
    image_path: Optional[str]
app_state = AppWidgetState()
explorer_state = ExploreAnnotatorState()

e_ = ExploreAnnotatorGUI(
    app_state=app_state,
    explorer_state=explorer_state
)

e_._state.image_path = '../data/projects/im2im1/pics/Grass1.png'
e_
storage = InMemoryStorage(Path('../data/projects/bbox/pics'))
app_state = AppWidgetState()
explorer_state = ExploreAnnotatorState()
controller = ExploreAnnotatorController(app_state, explorer_state, storage)
ExploreAnnotatorGUI(app_state, explorer_state)
#export

class ExploreAnnotator(Annotator):
    def __init__(
        self,
        project_path: Path,
        input_item: InputImage,
        output_item: Output,
        has_border: bool = False,
        *args, **kwargs
    ):
        app_state = AppWidgetState(uuid=str(id(self)), **{
            # "Input" has no attribute "width", "height"
            'size': (input_item.width, input_item.height)  # type: ignore
        })

        super().__init__(app_state)

        self._state = ExploreAnnotatorState(uuid=str(id(self)))

        # "Input" has no attribute "dir"
        self._storage = InMemoryStorage(project_path / input_item.dir)  # type: ignore

        self._controller = ExploreAnnotatorController(
            self.app_state,
            self._state,
            self._storage
        )

        self._view = ExploreAnnotatorGUI(
            self.app_state,
            self._state,
            fit_canvas=input_item.fit_canvas,
            has_border=has_border
        )

    def __repr__(self):
        display(self._view)
        return ""
from ipyannotator.mltypes import NoOutput

exp = ExploreAnnotator(
    project_path=Path('../data/projects/bbox/'),
    input_item=InputImage(image_dir='pics', image_width=400, image_height=400),
    output_item=NoOutput()
)