@@ -15,12 +15,14 @@ To run a prediction and return its output:
1515``` js
1616import replicate from " replicate" ;
1717
18- const prediction = await replicate .version (" <MODEL VERSION>" ).predict ({
19- prompt: " painting of a cat by andy warhol" ,
20- });
18+ const prediction = await replicate
19+ .version (" db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf" )
20+ .predict ({
21+ prompt: " painting of a cat by andy warhol" ,
22+ });
2123
2224console .log (prediction .output );
23- // "https://replicate.delivery/pbxt/lGWovsQZ7jZuNtPvofMth1rSeCcVn5xes8dWWdWZ64MlTi7gA /out-0.png"
25+ // "https://replicate.delivery/pbxt/oeJLu7D1Y7UWESpzerfINqgwZgONSCubSjSw0msf8i4AP2BCB /out-0.png"
2426```
2527
2628If you want to do something like updating progress while the prediction is
@@ -29,16 +31,18 @@ running, you can pass in an `onUpdate` callback function:
2931``` js
3032import replicate from " replicate" ;
3133
32- await replicate .version (" <MODEL VERSION>" ).predict (
33- {
34- prompt: " painting of a cat by andy warhol" ,
35- },
36- {
37- onUpdate : (prediction ) => {
38- console .log (prediction .output );
34+ await replicate
35+ .version (" db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf" )
36+ .predict (
37+ {
38+ prompt: " painting of a cat by andy warhol" ,
3939 },
40- }
41- );
40+ {
41+ onUpdate : (prediction ) => {
42+ console .log (prediction .output );
43+ },
44+ }
45+ );
4246```
4347
4448If you'd prefer to control your own polling you can use the low-level
@@ -47,9 +51,11 @@ If you'd prefer to control your own polling you can use the low-level
4751``` js
4852import replicate from " replicate" ;
4953
50- const prediction = await replicate .version (" <MODEL VERSION>" ).createPrediction ({
51- prompt: " painting of a cat by andy warhol" ,
52- });
54+ const prediction = await replicate
55+ .version (" db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf" )
56+ .createPrediction ({
57+ prompt: " painting of a cat by andy warhol" ,
58+ });
5359
5460console .log (prediction .status ); // "starting"
5561```
0 commit comments