You will add your code to the call() method of the LayerCustom_LayerCustom_1Keras class which is invoked by PerceptiLabs to transform data when the model runs (including when PerceptiLabs runs the model as you edit it in the Modeling Tool to display previews). In general, you will add your transformation(s) between the input and output assignments:
input_ = inputs['input']
"""add your transformation(s)/custom code here..."""
output = preview = input_
Tip: You can include import statements above the class declarations to import other Python modules.