From c8049fca8c49aae686e4734cd588897a46a83f74 Mon Sep 17 00:00:00 2001 From: Dominic Baggott Date: Mon, 4 Jul 2022 18:12:30 +0100 Subject: [PATCH] Add docs for prediction.cancel() Signed-off-by: Dominic Baggott --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 249d2ef1..750b669c 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,24 @@ iteration: 30, render:loss: -1.3994140625 'https://.../output.png' ``` +You can cancel a running prediction: + +```python +>>> model = replicate.models.get("kvfrans/clipdraw") +>>> prediction = replicate.predictions.create( +... version=model.versions.list()[0], +... input={"prompt":"Watercolor painting of an underwater submarine"}) + +>>> prediction.status +'starting' + +>>> prediction.cancel() + +>>> prediction.reload() +>>> prediction.status +'canceled' +``` + By default, `model.predict()` uses the latest version. If you want to pin to a particular version, you can get a version with its ID: ```