I've deployed a category trained model and hosted the endpoint.. and trying to inference this, but have a issue.. basically we take a short description i.e "laptop screen" this should return a category i.e "Hardware" the problem i'm facing is that i just seem to get this error when inferencing this via postman.
i.e if i send this {"data":"laptop screen"}
i get this error in the body
{
"errorMessage": "Expecting value: line 1 column 1 (char 0)",
"errorType": "JSONDecodeError",
"stackTrace": [
[
"/var/task/lambda_function.py",
21,
"lambda_handler",
"result = json.loads(response['Body'].read().decode())"
],
[
"/var/lang/lib/python3.6/json/__init__.py",
354,
"loads",
"return _default_decoder.decode(s)"
],
[
"/var/lang/lib/python3.6/json/decoder.py",
339,
"decode",
"obj, end = self.raw_decode(s, idx=_w(s, 0).end())"
],
[
"/var/lang/lib/python3.6/json/decoder.py",
357,
"raw_decode",
"raise JSONDecodeError(\"Expecting value\", s, err.value) from None"
]
]
}
this is my lambda function:
import os
import io
import boto3
import json
import csv
ENDPOINT_NAME = os.environ['ENDPOINT_NAME']
runtime= boto3.client('runtime.sagemaker')
def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))
data = json.loads(json.dumps(event))
payload = data['data']
print(payload)
response = runtime.invoke_endpoint(EndpointName=ENDPOINT_NAME,
ContentType='text/csv',
Body=payload)
print(response)
result = json.loads(response['Body'].read().decode())
return result
Ive added this to admin IAM role too
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sagemaker:InvokeEndpoint",
"Resource": "*"
}
Any assistance would be ace, i feel im pretty close it works fine when it comes to predicting priority, but need help when predicting category string.
{"data":"laptop screen", "content-type": "text/csv"}?responseis empty?