replicate / replicate-python

Python client for Replicate
https://replicate.com
Apache License 2.0
770 stars 222 forks source link

Fix bug with `wait` parameter in `replicate.run()` #363

Closed aron closed 1 month ago

aron commented 1 month ago

This PR fixes an issue with replicate.run() where it would fallback to polling irregardless of the wait parameter. We now skip the waiting if it looks like we have a prediction with output back.

There are a whole bunch of issues with the vcr library we're using at the moment. I've got it working but I don't think the fixtures are in an ideal state.

  1. The vcr recording mode doesn't work with asyncio, so you need to generate the fixtures using the sync api. Commenting out all of the async & await syntax. Then the test will run just fine without.
  2. The path argument passed to vcr() decorator is not respected while recording. Apparently it does work if you rename the generated file, but I've not tried this yet.