import numpy.typing as npt
from code_loader.contract.enums import LeapDataType
@dataclass
class LeapText:
data: List[str]
type: LeapDataType = LeapDataType.Text
import numpy as np
from code_loader.contract.visualizer_classes import LeapText
from code_loader import leap_binder
...
def text_visualizer_func(data: np.ndarray) -> LeapText:
tokenizer = leap_binder.custom_tokenizer
text = tokenizer.sequences_to_texts(data)
return LeapText(text)
leap_binder.set_visualizer(
name='text_from_token',
function=text_visualizer_func,
visualizer_type=LeapText.type
)