in src/inference.py [0:0]
def input_fn(request_body, content_type='application/jsonlines'):
if content_type == 'application/jsonlines':
print("request received!!")
print(type(request_body))
# Warning: for some reason, when Sagemaker is doing batch transform,
# it automatically adds a line break in the end, needs to strip the line break to avoid errors.
# Sagemaker Endpoint doesn't have such issue.
lines = request_body.decode("utf-8").rstrip(os.linesep).split(os.linesep)
data = []
print(len(lines))
for line in lines:
line = line.strip()
print(type(line), len(line))
input_data = json.loads(line)
data.append(input_data)
return data
raise Exception(f'Requested unsupported ContentType in content_type {content_type}')