Changelog #24

·

Replicate Integration

Eric Allam

Eric Allam

CTO, Trigger.dev

Image for Replicate Integration

Replicate lets you run machine learning models with a few lines of code, without needing to understand how machine learning works. And now you can easily use the Replicate API in your own applications using Trigger.dev and our new Replicate integration:


_25
client.defineJob({
_25
id: "replicate-cinematic-prompt",
_25
name: "Replicate - Cinematic Prompt",
_25
version: "0.1.0",
_25
integrations: { replicate },
_25
trigger: eventTrigger({
_25
name: "replicate.cinematic",
_25
}),
_25
run: async (payload, io, ctx) => {
_25
const prediction = await io.replicate.predictions.createAndAwait(
_25
"await-prediction",
_25
{
_25
version:
_25
"af1a68a271597604546c09c64aabcd7782c114a63539a4a8d14d1eeda5630c33",
_25
input: {
_25
prompt: `rick astley riding a harley through post-apocalyptic miami, cinematic, 70mm, anamorphic, bokeh`,
_25
width: 1280,
_25
height: 720,
_25
},
_25
}
_25
);
_25
_25
return prediction.output;
_25
},
_25
});

We make use of replicate webhooks and a new feature of Trigger.dev called "Task Callbacks" to ensure long-running predictions don't result in function timeout errors.

See more details in the Replicate integration docs.

Thanks to @nicktrn for the awesome work on this integration 🚀

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now
,