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):
4545 try :
4646 if hasattr (schema_builder , "custom_input_translator" ):
4747 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 ,
4954 )
5055 else :
5156 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 ],
5363 )
5464
5565 # 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):
6767 try :
6868 if hasattr (schema_builder , "custom_input_translator" ):
6969 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 ,
7176 )
7277 else :
7378 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 ],
7585 )
7686
7787 # 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):
7070 try :
7171 if hasattr (schema_builder , "custom_input_translator" ):
7272 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 ,
7479 )
7580 else :
7681 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 ],
7888 )
7989 except Exception as e :
8090 raise Exception ("Encountered error in deserialize_request." ) from e
You can’t perform that action at this time.
0 commit comments