Utils

class graphbook.utils.ProcessorStateRequest(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
graphbook.utils.image(path_or_pil: str | Image) dict

A simple helper function to create a Graphbook-recognizable image object. A path to an image file or a PIL Image object is supported for rendering in the UI. If the image is a PIL Image object, Graphbook will attempt to store it in a shared memory region if the feature is enabled. If shared memory is disabled, PIL Image objects will not be rendered in the UI.

Parameters:

path_or_pil (str | Image.Image) – A path to an image file or a PIL Image object.

graphbook.utils.transform_function_string(func_str)

This function is used to convert a string to a function by interpreting the string as a python-typed function definition. This is used to allow the user to define custom functions in the graphbook UI.