MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / __new__

Method __new__

digit-recognizer/app/predictors.py:27–31  ·  view source on GitHub ↗
(cls, *args, **kwargs)

Source from the content-addressed store, hash-verified

25
26 # ensure predictor be initialized only once by using Singleton Pattern
27 def __new__(cls, *args, **kwargs):
28 if not hasattr(cls, '__instance'):
29 cls.__instance = super().__new__(cls)
30 cls.__model = load_model('app/models/convolutional.h5')
31 return cls.__instance
32
33 @staticmethod
34 def predict(input_data):

Callers 1

__new__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected