replicate / replicate-go

Go client for Replicate
https://replicate.com
Apache License 2.0
65 stars 9 forks source link

Create polling example #44

Closed cartermp closed 6 months ago

mattt commented 6 months ago

Hey @cartermp! Thanks for opening this PR. We actually have a built-in Wait method that takes care of this for you, as well as a Run convenience method for running a model and waiting for its output. I just opened #45 with an example of how to use that.

There's a lot more we can do to document this library in the README and Go docs, and I'm excited to invest more in that. If you have any other questions or ideas for how to make things better, just let me know — I'd love to hear them.

cartermp commented 6 months ago

Ah, I see, thanks! I think additional examples would help the most, since I immediately went with the readme, then looked at the REST docs and saw about a need to poll: https://replicate.com/docs/reference/http#predictions.create

To get the final result of the prediction you should either provide a webhook HTTPS URL for us to call when the results are ready, or poll the get a prediction endpoint until it has finished.