Skip to content

Instantly share code, notes, and snippets.

@smothiki
Created August 9, 2023 22:17
Show Gist options
  • Save smothiki/cb50e2949dbd98169807ac709c60c514 to your computer and use it in GitHub Desktop.
Save smothiki/cb50e2949dbd98169807ac709c60c514 to your computer and use it in GitHub Desktop.
# split-oriented DataFrame input
curl http://127.0.0.1:5000/invocations -H 'Content-Type: application/json' -d '{
"dataframe_split": {
"columns": ["a", "b", "c"],
"data": [[1, 2, 3], [4, 5, 6]]
}
}'
# record-oriented DataFrame input (fine for vector rows, loses ordering for JSON records)
curl http://127.0.0.1:5000/invocations -H 'Content-Type: application/json' -d '{
"dataframe_records": [
{"a": 1,"b": 2,"c": 3},
{"a": 4,"b": 5,"c": 6}
]
}'
# numpy/tensor input using TF serving's "instances" format
curl http://127.0.0.1:5000/invocations -H 'Content-Type: application/json' -d '{
"instances": [
{"a": "s1", "b": 1, "c": [1, 2, 3]},
{"a": "s2", "b": 2, "c": [4, 5, 6]},
{"a": "s3", "b": 3, "c": [7, 8, 9]}
]
}'
# numpy/tensor input using TF serving's "inputs" format
curl http://127.0.0.1:5000/invocations -H 'Content-Type: application/json' -d '{
"inputs": {"a": ["s1", "s2", "s3"], "b": [1, 2, 3], "c": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment