@@ -22,9 +22,21 @@ def get_model_properties(
22
22
model_files : Union [str , Path , None ] = None ,
23
23
):
24
24
if type (model_files ) is dict :
25
- model = model_files ["ModelProperties.json" ]
26
- input_var = model_files ["inputVar.json" ]
27
- output_var = model_files ["outputVar.json" ]
25
+ try :
26
+ model = json .loads (model_files ["ModelProperties.json" ])
27
+ except json .JSONDecodeError :
28
+ model = model_files ["ModelProperties.json" ]
29
+
30
+ try :
31
+ input_var = json .loads (model_files ["inputVar.json" ])
32
+ except json .JSONDecodeError :
33
+ input_var = model_files ["inputVar.json" ]
34
+
35
+ try :
36
+ output_var = json .loads (model_files ["outputVar.json" ])
37
+ except json .JSONDecodeError :
38
+ output_var = model_files ["outputVar.json" ]
39
+
28
40
else :
29
41
with open (Path (model_files ) / "ModelProperties.json" ) as f :
30
42
model = json .load (f )
@@ -319,9 +331,7 @@ def import_model(
319
331
if isinstance (model_files , dict ):
320
332
zip_io_file = zm .zip_files (model_files , model_prefix , is_viya4 = False )
321
333
else :
322
- zip_io_file = zm .zip_files (
323
- Path (model_files ), model_prefix , is_viya4 = False
324
- )
334
+ zip_io_file = zm .zip_files (Path (model_files ), model_prefix , is_viya4 = False )
325
335
if cls .notebook_output :
326
336
print (f"All model files were zipped to { Path (model_files )} ." )
327
337
0 commit comments