























Our client libraries and API are now much faster at running models, particularly if a file is being returned.
The API now returns the response immediately. Before, you would have to poll to get the result.
If you’re using the Node.js or Python client libraries, you don’t have to worry about this. Upgrade to the latest version and it gets faster. Also, instead of returning HTTP URLs, they now return file objects, which helps you write them to storage or pass to HTTP responses.
Node.js
Install the beta version of the client library:
Then run the model:
Python
Update the client library:
Then run the model:
The client libraries returning file objects is a breaking change so be careful when you upgrade your apps.
HTTP API
If you’re using the HTTP API for models or deployments, you can now pass the header Prefer: wait, which will keep the connection open until the prediction has finished:
Output:
By default it will wait 60 seconds before returning the in-progress prediction. You can adjust that by passing a time, like Prefer: wait=10 to wait 10 seconds.
Take a look at the docs on creating a prediction for more details.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。