replicate / replicate-swift

Swift client for Replicate
https://replicate.com
Apache License 2.0
157 stars 33 forks source link

Add `run` method to `Client` #20

Closed mattt closed 1 year ago

mattt commented 1 year ago

Adds a convenience method to Client for running a model at a version and waiting for its output:

let output = try await replicate.run(
    "stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf", 
    ["prompt": "a 19th century portrait of a wombat gentleman"]
)

print(output)
// https://replicate.com/api/models/stability-ai/stable-diffusion/files/50fcac81-865d-499e-81ac-49de0cb79264/out-0.png