What worked for me:
model = tf.keras.models.load_model("model.h5")

conf = model.get_config()
model_config = model.get_config()
input_layer_name = model_config['layers'][0]['name']
model_config['layers'][0] = {
                      'name': 'new_input',
                      'class_name': 'InputLayer',
                      'config': {
                          'batch_input_shape': (2, 512, 768,3),
                          'dtype': 'float32',
                          'sparse': False,
                          'name': 'modified_input'
                      },
                      'inbound_nodes': []
                  }
model_config['layers'][1]['inbound_nodes'] = [[['new_input', 0, 0, {}]]]
model_config['input_layers'] = [['new_input', 0, 0]]
new_model = model.__class__.from_config(model_config, custom_objects={})  # change custom objects if necessary

new_model.set_weights(model.get_weights())

Found on stackoverflow python - Keras replacing input layer - Stack Overflow 4
Solved. But thanks anyway.