View Source Replicate (Replicate v1.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
Paginates through results provided by the endpoint_func
function.
Returns a stream of results.
Synchronously run a prediction in the format owner/name:version. Returns the output.
Link to this section Functions
Paginates through results provided by the endpoint_func
function.
Returns a stream of results.
examples
Examples
iex> stream = Replicate.paginate(&Replicate.Models.list/0) iex> first_batch = stream |> Enum.at(0) iex> first_batch |> length() 25 iex> %Replicate.Models.Model{name: name} = first_batch |> Enum.at(0) iex> name "hello-world"
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"]