From bb90306fa93b1e107d8cbde4f8a31b2da957c576 Mon Sep 17 00:00:00 2001 From: Mattt Zmuda Date: Fri, 28 Jun 2024 03:43:57 -0700 Subject: [PATCH 1/2] Update recommendations for passing file inputs to models Signed-off-by: Mattt Zmuda --- README.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a547292f..26779293 100644 --- a/README.md +++ b/README.md @@ -54,20 +54,6 @@ replicate.run( ) ``` -Some models, like [andreasjansson/blip-2](https://replicate.com/andreasjansson/blip-2), have files as inputs. -To run a model that takes a file input, -pass a URL to a publicly accessible file. -Or, for smaller files (<10MB), you can pass a file handle directly. - -```python ->>> output = replicate.run( - "andreasjansson/blip-2:f677695e5e89f8b236e52ecd1d3f01beb44c34606419bcc19345e046d8f786f9", - input={ "image": open("path/to/mystery.jpg") } - ) - -"an astronaut riding a horse" -``` - > [!NOTE] > You can also use the Replicate client asynchronously by prepending `async_` to the method name. > @@ -94,6 +80,19 @@ Or, for smaller files (<10MB), you can pass a file handle directly. > print(results) > ``` +To run a model that takes a file input you can pass either +a URL to a publicly accessible file on the Internet +or a handle to a file on your local device. + +```python +>>> output = replicate.run( + "andreasjansson/blip-2:f677695e5e89f8b236e52ecd1d3f01beb44c34606419bcc19345e046d8f786f9", + input={ "image": open("path/to/mystery.jpg") } + ) + +"an astronaut riding a horse" +``` + ## Run a model and stream its output Replicate’s API supports server-sent event streams (SSEs) for language models. From eec9722d498323e38626be4967e7a8c58e0262a6 Mon Sep 17 00:00:00 2001 From: Mattt Zmuda Date: Fri, 28 Jun 2024 03:44:14 -0700 Subject: [PATCH 2/2] Change NOTE to TIP Signed-off-by: Mattt Zmuda --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26779293..49c39beb 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ replicate.run( ) ``` -> [!NOTE] +> [!TIP] > You can also use the Replicate client asynchronously by prepending `async_` to the method name. > > Here's an example of how to run several predictions concurrently and wait for them all to complete: