Predict API Docs for:
This interface takes in {{ len_inputs }} input(s) and returns {{ len_outputs }} output(s).
The URL endpoint is:
Input(s): [{%for i in range(0, len_inputs)%} {{inputs[i]}}{% if i != len_inputs - 1 %} ,{% endif %}{%endfor%} ]
-
{%for i in range(0, len_inputs)%}
- {{inputs[i]}} accepts the {{ input_types_doc[i]}} as type {{ input_types[i] }} {%endfor%}
Output(s): [{%for i in range(0, len_outputs)%} {{outputs[i]}}{% if i != len_outputs - 1 %} ,{% endif %}{%endfor%} ]
-
{%for i in range(0, len_outputs)%}
- {{outputs[i]}} returns the {{ output_types_doc[i]}} as type {{ output_types[i]}} {%endfor%}
Payload:
{
"data": [{%for i in range(0, len_inputs)%} {{ input_types[i] }}{% if i != len_inputs - 1 %} ,{% endif %}{%endfor%} ]
}
Note: This interface requires authentication. This means you will have to first post to the login api before you can post to the predict endpoint. See below for more info
{% endif %}Response:
{
"data": [{%for i in range(0, len_outputs)%} {{ output_types[i] }}{% if i != len_outputs - 1 %} ,{% endif %}{%endfor%} ],
"durations": [ float ], # the time taken for the prediction to complete
"avg_durations": [ float ] # the average time taken for all predictions so far (used to estimate the runtime)
}
Try it (live demo):
import requests
sess = requests.session()
sess.post(url='
',
data={"username": "USERNAME", "password":"PASSWORD"})r = sess.post(url='
',
json={"data":
[{% for i in range(0, len_inputs) %}{{ sample_inputs[i]|tojson }}{% if i != len_inputs - 1 %},
{% endif %}{%endfor%}]})
r.json()
{% else %}import requests
r = requests.post(url='
',
json={"data":
[{% for i in range(0, len_inputs) %}{{ sample_inputs[i]|tojson }}{% if i != len_inputs - 1 %},
{% endif %}{%endfor%}]})
r.json()
{% endif %}curl -X POST -F 'username=USERNAME' -F 'password=PASSWORD' -c cookies.txt
curl -X POST
-H 'Content-Type: application/json' -d '{"data": [{%for i in range(0, len_inputs)%}{{ sample_inputs[i]|tojson }}{% if i != len_inputs - 1 %},
{% endif %}{%endfor%}]}' -b cookies.txt
{% else %}curl -X POST
-H 'Content-Type: application/json' -d '{"data": [{%for i in range(0, len_inputs)%}{{ sample_inputs[i]|tojson }}{% if i != len_inputs - 1 %},
{% endif %}{%endfor%}]}'
{% endif %}// Will only work locally.
fetch('', { method: "POST", body: "username=USERNAME&password=PASSWORD"
, credentials: 'same-origin', headers: { "Content-Type": "application/x-www-form-urlencoded" } })
fetch('', { method: "POST", body: JSON.stringify({"data":[{%for i in range(0, len_inputs)%} {{ sample_inputs[i]|tojson }}{% if i != len_inputs - 1 %},{% endif %}{%endfor%}
]}), credentials: 'same-origin', headers: { "Content-Type": "application/json" } }).then(function(response) { return response.json(); }).then(function(json_response){ console.log(json_response) })
{% else %}fetch('', { method: "POST", body: JSON.stringify({"data":[{%for i in range(0, len_inputs)%} {{ sample_inputs[i]|tojson }}{% if i != len_inputs - 1 %},{% endif %}{%endfor%}
]}), headers: { "Content-Type": "application/json" } }).then(function(response) { return response.json(); }).then(function(json_response){ console.log(json_response) })
{% endif %}Live POST is turned off for interfaces that require authentication.
{
"data": ,
"durations": ,
"avg_durations":
}