Deploying custom model

I am facing trouble and confusion as to how can i save and deploy this model for a web app here is my model architecture code:
It has first 2 layers from tensorflow hub (bert model)
I face trouble everytime I load it from .h5 version saying that Hub.KerasLayers are custom and I need to define them.
Is there any workaround for this?

# Load BERT preprocessor and encoder
bert_preprocess = hub.KerasLayer("https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/3")
bert_encoder = hub.KerasLayer("https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/4")
# Define input layer
text_input = tf.keras.layers.Input(shape=(), dtype=tf.string, name='text')
# Preprocess text using BERT
preprocessed_text = bert_preprocess(text_input)
# Encode preprocessed text using BERT
outputs = bert_encoder(preprocessed_text)
reshaped_output = tf.expand_dims(outputs['pooled_output'], axis=1)
# LSTM layer
lstm_layer = tf.keras.layers.LSTM(64, name="lstm")(reshaped_output)
# Neural network layers
l = tf.keras.layers.Dropout(0.1, name="dropout")(outputs['pooled_output'])
l=tf.keras.layers.Dense(32,activation='relu',name='hiddenn')(l)
l=tf.keras.layers.Dense(8,activation='relu',name='hiddennn')(l)
l = tf.keras.layers.Dense(1, activation='sigmoid', name="output")(l)
# Construct final model
model = tf.keras.Model(inputs=[text_input], outputs=[l])

Should I change the custom bert layers?

error i am getting during deployment:

Uncaught (in promise) Error: Unknown layer: KerasLayer. This may be due to one of the following reasons:
1. The layer is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
2. The custom layer is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().
    at Vse (generic_utils.js:243:13)
    at rle (serialization.js:31:10)
    at s (container.js:1264:11)
    at value (container.js:1292:7)
    at Vse (generic_utils.js:278:11)
    at rle (serialization.js:31:10)
    at models.js:308:7
    at h (tf.min.js:17:2100)
    at Generator.<anonymous> (tf.min.js:17:3441)
    at Generator.next (tf.min.js:17:2463)

Hi @Ananya ,

I’m having trouble understanding how you’re loading your model. If you are using TFJS to load your model, you will need to first convert it to the TFJS format before loading. Additionally, in this case, you must define your custom layer class. Alternatively, if you’re adding a custom layer with TFJS, you’ll need to register your custom layer using the registerClass.

Let me know if it helps.

Thank You!!