[x] I have searched to see if a similar issue already exists.
Is your feature request related to a problem? Please describe.
The streaming API for the @gradio/client isn't really that nice. I think we should switch to an async iterator, we would go from this:
const app = Client.create();
const job = app.submit("/endpoint", body)
job.on("data", data => {
// do something with data
})
job.on("status",status => {
// do something with status
})
fits into a linear await flow better which is the standard in JS now
Other thoughts
@freddyaboulton @abidlabs Should the python client follow a similar pattern and return an iterator for streams instead? I've seen this pattern quite a bit recently when working with streams and found it really nice.
Is your feature request related to a problem? Please describe.
The streaming API for the
@gradio/client
isn't really that nice. I think we should switch to an async iterator, we would go from this:To this:
Benefits:
await
flow better which is the standard in JS nowOther thoughts
@freddyaboulton @abidlabs Should the python client follow a similar pattern and return an iterator for streams instead? I've seen this pattern quite a bit recently when working with streams and found it really nice.