Skip to content

Commit 475f5d9

Browse files
zekebfirsh
authored andcommitted
document loading an output file from a URL
Signed-off-by: Zeke Sikelianos <[email protected]>
1 parent b5c9493 commit 475f5d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ You can list all the predictions you've run:
111111
[<Prediction: 8b0ba5ab4d85>, <Prediction: 494900564e8c>]
112112
```
113113

114+
Output files are returned as HTTPS URLs. You can load an output file as a buffer:
115+
116+
```python
117+
import replicate
118+
from urllib.request import urlretrieve
119+
120+
model = replicate.models.get("stability-ai/stable-diffusion")
121+
version = model.versions.get("27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478")
122+
out = version.predict(prompt="wavy colorful abstract patterns, cgsociety"
123+
urlretrieve(out[0], "/tmp/out.png")
124+
background = Image.open("/tmp/out.png")
125+
```
126+
114127
## Install
115128

116129
```sh

0 commit comments

Comments
 (0)