modules/py_ml: Fix model kwargs. (#2280)

* modules/py_ml: Fix model kwargs.
This commit is contained in:
Ibrahim Abdelkader 2024-07-14 23:44:37 +02:00 committed by GitHub
parent 0ed19e085d
commit 357b6f9b07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ from ml.preprocessing import Normalization
class Model(uml.Model): class Model(uml.Model):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, kwargs.get("load_to_fb", False))
def predict(self, args, **kwargs): def predict(self, args, **kwargs):
args = [Normalization()(x) if isinstance(x, image.Image) else x for x in args] args = [Normalization()(x) if isinstance(x, image.Image) else x for x in args]

View File

@ -266,7 +266,7 @@ mp_obj_t py_ml_model_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
enum { ARG_path, ARG_load_to_fb }; enum { ARG_path, ARG_load_to_fb };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_path, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_path, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_load_to_fb, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false } }, { MP_QSTR_load_to_fb, MP_ARG_REQUIRED | MP_ARG_BOOL },
}; };
// Parse args. // Parse args.