replicate / zoo

🦓 Zoo — Image Playground
https://zoo.replicate.dev
Apache License 2.0
319 stars 110 forks source link

Rely on app database rather than replicate for prediction polling #64

Closed aron closed 10 months ago

aron commented 10 months ago

Currently we're hitting the replicate backend every 500ms per prediction while waiting for the prediction to complete. This results in a lot of bandwidth between the client and replicate and eats up a fair amount of time.

This PR tweaks the logic to hit the database instead and return a {id: string, status: "unknown"} string if no record is found (i.e we've not yet received the success hook from replicate).

I also had to get this running locally so I've made some small tweaks to the error handling and extended the configuration to support a configurable image bucket NEXT_PUBLIC_SUPABASE_IMAGES_HOST so local images work as expected.

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zoo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2023 1:45pm
cbh123 commented 10 months ago

Thank you Aron! This looks great to me, and works on my tests