Skip to content

Conversation

@mattt
Copy link
Contributor

@mattt mattt commented Jul 28, 2023

Follow up to #106

This PR adds a progress callback parameter to the run method. The function is called with the prediction initially after creation, after each polling update, and after completion.

const model = "stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478";
const input = {
  prompt: "a 19th century portrait of a raccoon gentleman wearing a suit",
};
const output = await replicate.run(model, { input }, (prediction) => {
  console.log(prediction)
});

This PR also fixes a bug in the implementation of the wait method's stop parameter, where the callback wasn't called after the first polling request.

@mattt mattt merged commit 68da42d into main Jul 28, 2023
@mattt mattt deleted the mattt/progress branch July 28, 2023 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants