Skip to content

Commit

Permalink
Fix streaming example (#205)
Browse files Browse the repository at this point in the history
* Fix streaming example

The example to use replicate.stream was wrongly checking the event type and was not producing any output.

* Update README.md

Co-authored-by: Mattt <mattt@me.com>

* Update README.md

Co-authored-by: Mattt <mattt@me.com>

* Update README.md

Removing the console.dir since it's no longer relevant

---------

Co-authored-by: Mattt <mattt@me.com>
  • Loading branch information
dkundel and mattt committed Feb 16, 2024
1 parent 496d55a commit d09067c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,9 @@ const options = {
};
const output = [];

for await (const event of replicate.stream(model, options)) {
console.debug({ event });
if (event && event === "output") {
output.push(event.data);
for await (const { event, data } of replicate.stream(model, options)) {
if (event === "output") {
output.push(data);
}
}

Expand Down

0 comments on commit d09067c

Please sign in to comment.