replicate / cli

CLI for Replicate
https://replicate.com
Apache License 2.0
68 stars 11 forks source link

Unable to run `show` or `scaffold` for predictions I don't own #62

Open zeke opened 7 months ago

zeke commented 7 months ago

TLDR

replicate show and replicate scaffold works for predictions owned by my token, but not for any other predictions, even if they're shared.

I'm not sure if this is a regression, or if it has never worked for non-owners.

Long story

I tried running the scaffold example in the README

I can see that prediction on the web, even in an incognito window: https://replicate.com/p/jpgp263bdekvxileu2ppsy46v4

But when I tried to scaffold from it, I get an error:

$ replicate scaffold https://replicate.com/p/jpgp263bdekvxileu2ppsy46v4 --template=node
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.

Sometimes zsh is a bit finicky about unquoted strings, so I tried quoting the URL:

replicate scaffold "https://replicate.com/p/jpgp263bdekvxileu2ppsy46v4" --template=node
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.

Then I tried just the prediction id, but still no joy:

$ replicate scaffold jpgp263bdekvxileu2ppsy46v4 --template=node  
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.

My own prediction works

So then I thought.. maybe I'm not authenticated?

But I can run the scaffold command for my own predictions, created with my zeke account on Replicate:

$ replicate scaffold 7khq4kzbhoogsnjgcujur7hhgi
Cloning starter repo and installing dependencies...
Cloning into '7khq4kzbhoogsnjgcujur7hhgi'...
...
Done!

A new shared prediction that I don't own doesn't work

Next I created a prediction from one of my orgs (replicate), then shared it: https://replicate.com/p/elqle2bbcval7o53g7w5wpub4u

But using the CLI with my personal token (not the org token), it fails:

$ replicate prediction show elqle2bbcval7o53g7w5wpub4u
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.
$ replicate scaffold elqle2bbcval7o53g7w5wpub4u                            
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.

Version

$ replicate --version
replicate version 0.7.0

cc @replicate/product @replicate/hackers

zeke commented 7 months ago

Turns out this is blocked by the API itself. It's not currently possible to fetched another user's shared prediction via API.

Internal issue to track this: https://linear.app/replicate/issue/PRO-48/get-shared-predictions-via-the-api