-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.sh
More file actions
executable file
·34 lines (25 loc) · 946 Bytes
/
query.sh
File metadata and controls
executable file
·34 lines (25 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# check if model is inactive
if [[ $(aws sagemaker list-models | jq ".Models[0].ModelName") == null ]]; then
echo "model inactive. run './summarize deploy' to deploy model and activate the query functionality"
exit 1
fi
# take command line input - should be name of file
if [[ $# -eq 0 ]]; then
echo "no input file specified"
else
export image=$1
fi
# source check_active to ensure we have endpoint & model names in environment
export endpt=$(aws sagemaker list-endpoints | jq ".Endpoints[0].EndpointName")
# pull endpoint name & clean for invoke command
endpt_temp=$(echo $endpt | tr -d '"') # remove quotes for sagemaker invocation
echo "invoking endpoint..."
aws sagemaker-runtime invoke-endpoint \
--endpoint-name $endpt_temp \
--body fileb://tiger.jpg \
--content-type application/x-image \
--accept application/json \
result.txt
echo -e "finished, results in result.txt\n"
echo "result: "
exit 0