File size: 463 Bytes
2c7f168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import tensorflow as tf
import huggingface_hub

model = tf.keras.models.load_model('/ANN.h5')

class CustomModel:
    def __init__(self, model):
        self.model = model

    def __call__(self, inputs):
        # Preprocess inputs if needed
        processed_inputs = preprocess(inputs)
        # Run inference
        outputs = self.model(processed_inputs)
        return outputs

custom_model = CustomModel(model)
huggingface_hub.ModelAPI(custom_model).run()