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

Method __new__

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

Source from the content-addressed store, hash-verified

6
7 # ensure predictor be initialized only once by using Singleton Pattern
8 def __new__(cls, *args, **kwargs):
9 if not hasattr(cls, '__instance'):
10 cls.__instance = super().__new__(cls)
11 cls.__model = load_model('app/models/regression.h5')
12 return cls.__instance
13
14 @staticmethod
15 def predict(input_data):

Callers

nothing calls this directly

Calls 1

__new__Method · 0.45

Tested by

no test coverage detected