Add back old dream.py
as legacy_api.py
#1070
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thatdream.py
used.Finally
legacy_api.py
is whatdream.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 hasha77799226a4dfc62a1674498e575c775da042959a4b90b13e26f666c302f079f
(which is what the test expects) and old image gets hash1e4c442663ca04d0b39ba8a001749b75ff78e6f300ddd1ce34e54c82088ac98b
.If you compare the two images with
magick compare
, the difference seems to be huge:But the actual difference in the images is marginal.
Old file

New file

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