Skip to content

Commit cd09db0

Browse files
GothReigenzeke
authored andcommitted
Update README example from version.predict
Context: > Model.predict was removed in #71. It points users to Version.predict, but that method was deprecated in favor of replicate.run in #79. #137 Trying the example in the current iteration of `replicate/replicate-python` would return the following exception: ```python discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Version' object has no attribute 'predict' ``` Signed-off-by: Michael Lee <[email protected]>
1 parent 73f0137 commit cd09db0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,14 @@ Output files are returned as HTTPS URLs. You can load an output file as a buffer
230230

231231
```python
232232
import replicate
233+
from PIL import Image
233234
from urllib.request import urlretrieve
234235

235-
model = replicate.models.get("stability-ai/stable-diffusion")
236-
version = model.versions.get("27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478")
237-
out = version.predict(prompt="wavy colorful abstract patterns, cgsociety")
236+
out = replicate.run(
237+
"stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478",
238+
input={"prompt": "wavy colorful abstract patterns, oceans"}
239+
)
240+
238241
urlretrieve(out[0], "/tmp/out.png")
239242
background = Image.open("/tmp/out.png")
240243
```

0 commit comments

Comments
 (0)