-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hi there
I am reading https://replicate.com/docs/guides/swiftui to use swiftui replicate sdk to call the model.
And i find out that some models do not have the version on web page.
Question1
- Which method do you recommend if I need to use different replicate models?
seems like in getModel Method, I will use multiple if else because different models need different input
enum StableDiffusion: Predictable {
static var modelID = "stability-ai/stable-diffusion"
static let versionID = "db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
struct Input: Codable {
let prompt: String
}
typealias Output = [URL]
}or
let model = try await replicate.getModel("stability-ai/stable-diffusion-3")
if let latestVersion = model.latestVersion {
let prompt = "a 19th century portrait of a gentleman otter"
let prediction = try await replicate.createPrediction(version: latestVersion.id,
input: ["prompt": "\(prompt)"],
wait: true)
print(prediction.id)
// "s654jhww3hrm60ch11v8t3zpkg"
print(prediction.output)
// ["https://replicate.delivery/yhqm/bh9SsjWXY3pGKJyQzYjQlsZPzcNZ4EYOeEsPjFytc5TjYeNTA/R8_SD3_00001_.webp"]
}Question2
In enum Predictable, how can I receive input image?
Metadata
Metadata
Assignees
Labels
No labels