File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed
src/sagemaker/serve/model_server Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,21 @@ def input_fn(input_data, content_type):
45
45
try :
46
46
if hasattr (schema_builder , "custom_input_translator" ):
47
47
deserialized_data = schema_builder .custom_input_translator .deserialize (
48
- io .BytesIO (input_data ) if type (input_data )== bytes else io .BytesIO (input_data .encode ('utf-8' )), content_type
48
+ (
49
+ io .BytesIO (input_data )
50
+ if type (input_data ) == bytes
51
+ else io .BytesIO (input_data .encode ("utf-8" ))
52
+ ),
53
+ content_type ,
49
54
)
50
55
else :
51
56
deserialized_data = schema_builder .input_deserializer .deserialize (
52
- io .BytesIO (input_data ) if type (input_data )== bytes else io .BytesIO (input_data .encode ('utf-8' )), content_type [0 ]
57
+ (
58
+ io .BytesIO (input_data )
59
+ if type (input_data ) == bytes
60
+ else io .BytesIO (input_data .encode ("utf-8" ))
61
+ ),
62
+ content_type [0 ],
53
63
)
54
64
55
65
# Check if preprocess method is defined and call it
Original file line number Diff line number Diff line change @@ -67,11 +67,21 @@ def input_fn(input_data, content_type):
67
67
try :
68
68
if hasattr (schema_builder , "custom_input_translator" ):
69
69
deserialized_data = schema_builder .custom_input_translator .deserialize (
70
- io .BytesIO (input_data ) if type (input_data )== bytes else io .BytesIO (input_data .encode ('utf-8' )), content_type
70
+ (
71
+ io .BytesIO (input_data )
72
+ if type (input_data ) == bytes
73
+ else io .BytesIO (input_data .encode ("utf-8" ))
74
+ ),
75
+ content_type ,
71
76
)
72
77
else :
73
78
deserialized_data = schema_builder .input_deserializer .deserialize (
74
- io .BytesIO (input_data ) if type (input_data )== bytes else io .BytesIO (input_data .encode ('utf-8' )), content_type [0 ]
79
+ (
80
+ io .BytesIO (input_data )
81
+ if type (input_data ) == bytes
82
+ else io .BytesIO (input_data .encode ("utf-8" ))
83
+ ),
84
+ content_type [0 ],
75
85
)
76
86
77
87
# Check if preprocess method is defined and call it
Original file line number Diff line number Diff line change @@ -70,11 +70,21 @@ def input_fn(input_data, content_type):
70
70
try :
71
71
if hasattr (schema_builder , "custom_input_translator" ):
72
72
return schema_builder .custom_input_translator .deserialize (
73
- io .BytesIO (input_data ) if type (input_data )== bytes else io .BytesIO (input_data .encode ('utf-8' )), content_type
73
+ (
74
+ io .BytesIO (input_data )
75
+ if type (input_data ) == bytes
76
+ else io .BytesIO (input_data .encode ("utf-8" ))
77
+ ),
78
+ content_type ,
74
79
)
75
80
else :
76
81
return schema_builder .input_deserializer .deserialize (
77
- io .BytesIO (input_data ) if type (input_data )== bytes else io .BytesIO (input_data .encode ('utf-8' )), content_type [0 ]
82
+ (
83
+ io .BytesIO (input_data )
84
+ if type (input_data ) == bytes
85
+ else io .BytesIO (input_data .encode ("utf-8" ))
86
+ ),
87
+ content_type [0 ],
78
88
)
79
89
except Exception as e :
80
90
raise Exception ("Encountered error in deserialize_request." ) from e
You can’t perform that action at this time.
0 commit comments