Skip to content

Commit

Permalink
Update README example from version.predict
Browse files Browse the repository at this point in the history
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: GothReigen <reigen@replicate.com>
  • Loading branch information
GothReigen committed Feb 9, 2024
1 parent 73f0137 commit bf5454d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,14 @@ Output files are returned as HTTPS URLs. You can load an output file as a buffer

```python
import replicate
from PIL import Image
from urllib.request import urlretrieve

model = replicate.models.get("stability-ai/stable-diffusion")
version = model.versions.get("27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478")
out = version.predict(prompt="wavy colorful abstract patterns, cgsociety")
out = replicate.run(
"stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478",
input={"prompt": "wavy colorful abstract patterns, oceans"}
)

urlretrieve(out[0], "/tmp/out.png")
background = Image.open("/tmp/out.png")
```
Expand Down

0 comments on commit bf5454d

Please sign in to comment.