Update predict.py (#4897)
Update predict.py (#4897)

* Update predict.py

Calling the discovery API for every prediction is bad practice, leads to high latency, and also users will very quickly hit the quota imposed on the CRUD server. We've had multiple customers hit this issue, and I can only assume that they are copying and pasting this code.

I think a class would be more elegant here, but this quick fix should at least get us started along a better path.

* Add extra line break before function (for linter)

Co-authored-by: Bu Sun Kim <e20aa14702d7e04a52a901b5515eeecef97a5b5f@users.noreply.github.com>
Co-authored-by: Alec Glassford <f3be16bb5563b36a95fb3d6dc8a8fc5ddb75685f@google.com>
GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples