Skip to content

Add back old dream.py as legacy_api.py #1070

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 2 commits into from
Oct 13, 2022
Merged

Conversation

CapableWeb
Copy link
Contributor

This commit "reverts" the new API changes by extracting the old functionality into new files.

The work is based on the commit 803a51d5adca7e6e28491fc414fd3937bee7cb79

PngWriter regained PromptFormatter as old server used that.

server_legacy.py is the old server that dream.py used.

Finally legacy_api.py is what dream.py used to be at the mentioned commit.

One manually run test has been added in order to be able to test compatibility with the old API, currently just testing that the API endpoint works the same way + the image hash is the same as it used to be before.

Currently, the image hash is different than what it would be if output with the old dream.py. Reasons for this is unknown. New image gets hash a77799226a4dfc62a1674498e575c775da042959a4b90b13e26f666c302f079f (which is what the test expects) and old image gets hash 1e4c442663ca04d0b39ba8a001749b75ff78e6f300ddd1ce34e54c82088ac98b.

If you compare the two images with magick compare, the difference seems to be huge:

diff

But the actual difference in the images is marginal.

Old file
000001 1337

New file
000001 1337

Both versions of the version to generate the image was run with the same options/parameters, so probably some minor default value that has changed that is introducing the change. But again, think it's marginal enough to consider it OK.

Secondary, I've added a CODEOWNERS file as well which would add automatically add me as a reviewer to any PR that happens to touch these files. More information about the functionality of the CODEOWNERS file: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

CapableWeb added 2 commits October 12, 2022 20:05
This commit "reverts" the new API changes by extracting the old
functionality into new files.

The work is based on the commit `803a51d5adca7e6e28491fc414fd3937bee7cb79`

PngWriter regained PromptFormatter as old server used that.

`server_legacy.py` is the old server that `dream.py` used.

Finally `legacy_api.py` is what `dream.py` used to be at the mentioned
commit.

One manually run test has been added in order to be able to test
compatibility with the old API, currently just testing that the API
endpoint works the same way + the image hash is the same as it used to
be before.
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

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

I greatly appreciate your doing this.

At some point soon, could you add a new documentation file (maybe named docs/features/LEGACY_API.md) that describes the legacy API and its use?

@lstein lstein merged commit 94bad85 into invoke-ai:main Oct 13, 2022
@CapableWeb
Copy link
Contributor Author

@lstein thanks! Yeah, will do :)

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