View Source Replicate (Replicate v0.3.0)

This is the Official Elixir client for Replicate. It lets you run models from your Elixir code, and do various other things on Replicate.

Link to this section Summary

Functions

Asynchronously run a prediction. You can also use Replicate.Predictions.create directly.

Synchronously run a prediction in the format owner/name:version. Returns the output.

Link to this section Functions

Link to this function

async_run(version, input)

View Source

Asynchronously run a prediction. You can also use Replicate.Predictions.create directly.

examples

Examples

iex> {:ok, prediction} = Replicate.async_run("stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf", prompt: "a 19th century portrait of a wombat gentleman")
iex> prediction.status
"starting"

Synchronously run a prediction in the format owner/name:version. Returns the output.

You can also use Replicate.Predictions.create and Replicate.Predictions.wait directly.

examples

Examples

iex> Replicate.run("stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf", prompt: "a 19th century portrait of a wombat gentleman")
["https://replicate.com/api/models/stability-ai/stable-diffusion/files/50fcac81-865d-499e-81ac-49de0cb79264/out-0.png"]