Skip to content

Commit b86aca7

Browse files
authored
Update recommendations for passing file inputs to models (#315)
Signed-off-by: Mattt Zmuda <[email protected]>
1 parent a78cc1e commit b86aca7

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,7 @@ replicate.run(
5454
)
5555
```
5656

57-
Some models, like [andreasjansson/blip-2](https://replicate.com/andreasjansson/blip-2), have files as inputs.
58-
To run a model that takes a file input,
59-
pass a URL to a publicly accessible file.
60-
Or, for smaller files (<10MB), you can pass a file handle directly.
61-
62-
```python
63-
>>> output = replicate.run(
64-
"andreasjansson/blip-2:f677695e5e89f8b236e52ecd1d3f01beb44c34606419bcc19345e046d8f786f9",
65-
input={ "image": open("path/to/mystery.jpg") }
66-
)
67-
68-
"an astronaut riding a horse"
69-
```
70-
71-
> [!NOTE]
57+
> [!TIP]
7258
> You can also use the Replicate client asynchronously by prepending `async_` to the method name.
7359
>
7460
> Here's an example of how to run several predictions concurrently and wait for them all to complete:
@@ -94,6 +80,19 @@ Or, for smaller files (<10MB), you can pass a file handle directly.
9480
> print(results)
9581
> ```
9682
83+
To run a model that takes a file input you can pass either
84+
a URL to a publicly accessible file on the Internet
85+
or a handle to a file on your local device.
86+
87+
```python
88+
>>> output = replicate.run(
89+
"andreasjansson/blip-2:f677695e5e89f8b236e52ecd1d3f01beb44c34606419bcc19345e046d8f786f9",
90+
input={ "image": open("path/to/mystery.jpg") }
91+
)
92+
93+
"an astronaut riding a horse"
94+
```
95+
9796
## Run a model and stream its output
9897

9998
Replicate’s API supports server-sent event streams (SSEs) for language models.

0 commit comments

Comments
 (0)