Skip to content

Add replicate.run() #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2023
Merged

Add replicate.run() #79

merged 1 commit into from
Mar 26, 2023

Conversation

bfirsh
Copy link
Member

@bfirsh bfirsh commented Mar 23, 2023

To be consistent with the JavaScript library. The rest of the API is only vaguely consistent, but this gets us a long way.

>>> import replicate
>>> replicate.run(
        "stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478",
        input={"prompt": "a 19th century portrait of a wombat gentleman"}
    )

['https://replicate.com/api/models/stability-ai/stable-diffusion/files/50fcac81-865d-499e-81ac-49de0cb79264/out-0.png']

Full examples in the README.

As an aside, I reformatted the readme to use the pretty standard Python REPL format. Shame we lost that – it made for a consistent copy & paste REPL session, and lost the syntax highlighting.

To be consistent with the JavaScript library.

Signed-off-by: Ben Firshman <ben@firshman.com>
@zeke
Copy link
Member

zeke commented Mar 23, 2023

I reformatted the readme to use the pretty standard Python REPL format. Shame we lost that

I took that out a while ago because it made nothing copy-paste-able, unless I missed something:

$ python
>>> >>> import replicate
  File "<stdin>", line 1
    >>> import replicate
    ^^
SyntaxError: invalid syntax

Copy link
Member

@zeke zeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@bfirsh
Copy link
Member Author

bfirsh commented Mar 23, 2023

I took that out a while ago because it made nothing copy-paste-able, unless I missed something:

Fair. I guess I'm used to copy and pasting. It's a common pattern with Python libraries to show a REPL session: https://requests.readthedocs.io/en/latest/

I'll leave this for now for the sake of saving time, and we can iterate on it again at some point.

@bfirsh
Copy link
Member Author

bfirsh commented Mar 23, 2023

Holding off on merging because we'll need to ship a new version ASAP because the readme acts as the documentation. If someone wants to merge and ship a release feel free. 😄

@bfirsh bfirsh merged commit 36ac90e into main Mar 26, 2023
@bfirsh bfirsh deleted the replicate-run branch March 26, 2023 01:25
GothReigen added a commit that referenced this pull request Jan 3, 2024
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'
```
GothReigen added a commit that referenced this pull request Jan 3, 2024
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: Michael Lee <michaellee@Michaels-MacBook-Pro.local>
zeke pushed a commit that referenced this pull request Jan 4, 2024
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: Michael Lee <michaellee@Michaels-MacBook-Pro.local>
GothReigen added a commit that referenced this pull request Feb 9, 2024
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>
GothReigen added a commit that referenced this pull request Mar 11, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants