Expand description
Used to interact with the Prediction Endpoints.
§Example
use replicate_rust::{Replicate, config::Config};
let config = Config::default();
let replicate = Replicate::new(config);
// Construct the inputs.
let mut inputs = std::collections::HashMap::new();
inputs.insert("prompt", "a 19th century portrait of a wombat gentleman");
let version = "stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478";
// Run the model.
let result = replicate.predictions.create(version, inputs)?.wait()?;
// Print the result.
println!("Result : {:?}", result.output);
§Another example to showcase other methods
use replicate_rust::{Replicate, config::Config};
let config = Config::default();
let replicate = Replicate::new(config);
// Construct the inputs.
let mut inputs = std::collections::HashMap::new();
inputs.insert("prompt", "a 19th century portrait of a wombat gentleman");
let version = "stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478";
// Run the model.
let mut prediction = replicate.predictions.create(version, inputs)?;
println!("Prediction : {:?}", prediction.status);
// Refetch the prediction using the reload method.
let _ = prediction.reload();
println!("Prediction : {:?}", prediction.status);
// Cancel the prediction.
let _ = prediction.cancel();
println!("Predictions : {:?}", prediction.status);;
// Wait for the prediction to complete (or fail).
println!("Prediction : {:?}", prediction.wait()?);
Structs§
- Prediction
- Used to interact with the Prediction Endpoints.
- Prediction
Payload - Used to interact with the Prediction Endpoints.