Skip to content
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

[Feature Request] Turning OpenOutpaint into an A1111 Extension #109

Closed
wywywywy opened this issue Dec 18, 2022 · 43 comments
Closed

[Feature Request] Turning OpenOutpaint into an A1111 Extension #109

wywywywy opened this issue Dec 18, 2022 · 43 comments
Assignees
Labels
enhancement New feature or request

Comments

@wywywywy
Copy link

Is your feature request related to a problem? Please describe.
OpenOutpaint is a great idea. But having to run another app does not make the workflow seamless.

Describe the solution you'd like
Add OpenOutpaint as an extension to A1111. This will become a new "Outpaint" tab in the A1111 UI.

Describe alternatives you've considered
I guess you could edit the webui-user.bat file to run both A1111 and OpenOutpaint at the same time, but it is still not really seamless.

Additional context
It should be simple (I think) to build an iframe in a tab. So the changes to the codebase shouldn't be too big.

In the future it could have additional features such as sending a generated image from the "txt2img" tab to the "Outpaint" tab.

@wywywywy wywywywy added the enhancement New feature or request label Dec 18, 2022
@seijihariki
Copy link
Collaborator

Could be a thing I guess? Haven't seen how extensions work but as we only need some basic hosting for some files, an iframe should work just fine.

Though updates may be a bit hard to apply depending on browser caching. Maybe add something to handle that.

Also should lock the host field and have a button to allow for iframe refreshing, as we don't really have a reset button for some functionalities (canvas expansion).

We should also not pollute the webui's local storage or IndexedDB, so starting some parallel file hosting would be preferable.

@seijihariki
Copy link
Collaborator

We could probably achieve complete integration sending resources between the two interfaces using messaging, actually.

@seijihariki
Copy link
Collaborator

@zero01101, what do you think? We can use a separate repo for this, I think, for the actual extension and python code involved. For communication with the webui itself, we can use messaging between webui and openOutpaint: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage.

@zero01101
Copy link
Owner

zero01101 commented Dec 18, 2022

hah, earlier this morning i actually tried messing with just a very remedial attempt at getting an iframe in there like suggested; my python is admittedly worse than my javascript, and i couldn't figure out how in blue blazes to get it to embed a git clone of openOutpaint, but just as a stupid test got the github.io-hosted one "working"... not sure where the tool icons went though...

image

but agreed, i definitely think it'd be its own separate repo; i've got the install.py successfully cloning openOutpaint to the extension's directory already but that's, uh, pretty "step one" kinda stuff :/

i'm sure you'll be shocked to hear that i've never used postMessage() lmao

@seijihariki
Copy link
Collaborator

hah, earlier this morning i actually tried messing with just a very remedial attempt at getting an iframe in there like suggested; my python is admittedly worse than my javascript, and i couldn't figure out how in blue blazes to get it to embed a git clone of openOutpaint, but just as a stupid test got the github.io-hosted one "working"... not sure where the tool icons went though...

image

Hey, that's good! Can you try sending this to a new repo, so I can try doing it from there? And is the github-sites version of openOutpaint broken in terms of icon loading? That seems a bit strange to me.

but agreed, i definitely think it'd be its own separate repo; i've got the install.py successfully cloning openOutpaint to the extension's directory already but that's, uh, pretty "step one" kinda stuff :/

i'm sure you'll be shocked to hear that i've never used postMessage() lmao

Not really, as it has only some pretty niche applications. Primarily for inter-tab communication and parent-child iframe communication. I used this only once in my life for very basic stuff.

@zero01101
Copy link
Owner

zero01101 commented Dec 18, 2022

Hey, that's good!

lmao you will shortly discover that it is not ;)

And is the github-sites version of openOutpaint broken in terms of icon loading? That seems a bit strange to me.

sure is :| super bonkers, right?

invited you as a direct collaborator to https://github.com/zero01101/openOutpaint-webUI-extension :)

@wywywywy
Copy link
Author

It will probably be more suitable to make use of git submodules in the new git repo instead of trying to get git clone in python to work

@seijihariki
Copy link
Collaborator

Are submodules automatically downloaded on extension clone? If so, I agree.

@seijihariki
Copy link
Collaborator

And is the github-sites version of openOutpaint broken in terms of icon loading? That seems a bit strange to me.

sure is :| super bonkers, right?

invited you as a direct collaborator to https://github.com/zero01101/openOutpaint-webUI-extension :)

Just checked, this seems to be an issue of relative paths. openOutpaint, for now, assumes that it is being run on the server root, so it uses "/res" as a first part for icon loading. The thing is, if we use relative paths, the configuration page icons will break, as it is on another path. We can use "../res" for resources on the config page, but then we duplicate icon loading code, as CSS would not be able to be shared.

We could also move configuration.html from pages to root, but then we start filling the root with html pages... Not sure what is the better approach.

@seijihariki
Copy link
Collaborator

Added issue for discussion of implementation for the extension on the separate repository:
zero01101/openOutpaint-webUI-extension#1

@zero01101
Copy link
Owner

ok lmao wow that got really good at making me feel like a complete pillock lol

anyway, no more install script, submodules work finally, not "magically" installed unless you git clone --recursive or something, so i just added a submodule update routine to the script itself

definitely makes sense re: missing icons (and makes even more sense now that it's running off of the local submodule lol) but yeah, i'm not exactly sure what the best course of action is for that...

all that being said, it does seem to work as-is right now just by manually installing the extension from the repo url 👍

@seijihariki
Copy link
Collaborator

Is it already working from local install or does it still use GitHub pages?

@zero01101
Copy link
Owner

local install via git submodule :D

@seijihariki
Copy link
Collaborator

seijihariki commented Dec 18, 2022

local install via git submodule :D

Then will have to use relative paths probably; shouldn't be too big a change to fix the images... Just a general search and replace of /res/ to res/, and custom css for the X on the configuration.html file referencing ../res/

@zero01101
Copy link
Owner

zero01101 commented Dec 18, 2022

ooooo <3 might replacing with ./res/ be better?

@seijihariki
Copy link
Collaborator

Should do the same. If you prefer, ./res also works.

@zero01101
Copy link
Owner

aha, seems not as much as i'd like :|
image

@seijihariki
Copy link
Collaborator

Oh, the css are really loading relative files from their directories? That's... Suboptimal. Will probably have to refer to ../../res then.

@seijihariki
Copy link
Collaborator

In the upside, probably no duplication will actually need to happen for configuration.html to work.

@zero01101
Copy link
Owner

zero01101 commented Dec 18, 2022

yep, just tried exactly that for files in ui/tool (and simply ../res for files in ui) and it seems to have worked :) just pushed that to testing

lol uh guess i'll merge that to main since

  • it works
  • the extension kinda needs it there
    lil bad pokerface

@zero01101
Copy link
Owner

🎉
image

@seijihariki
Copy link
Collaborator

@wywywywy do you know how it works to add an extension to the main webui repo? Do we have to request it somewhere?

@wywywywy
Copy link
Author

Yea you gotta ping @ClashSAN to get your extension added to this page: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Extensions-index

@wywywywy
Copy link
Author

Once done it'll probably be a good idea to go onto to reddit and promote it a bit. To get more eyeballs on it

@seijihariki
Copy link
Collaborator

Yea you gotta ping @ClashSAN to get your extension added to this page: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Extensions-index

Oh, okay!

@wywywywy Give it a look now. It should be mostly working.

@wywywywy
Copy link
Author

Ok I don't have much time right now, but after a quick test, I can say that it looks good!

For the first release, I think it needs a couple of changes to be complete:

  1. It doesn't really need to ask the user for the server URL. It can just take it from the address bar because when acting as an extension, they'll always be the same
  2. When doing "Send to openOutpaint", it should also send the prompt

And going forward, it'd be really nice to have the ability to send the canvas to img2img, so that the user can further process it (e.g. with SD Upscale). Maybe "Send to extras" too.

Another thing is when using the "Save" button, it doesn't save the metadata. But it's a general issue, not specific to the extension.

@seijihariki
Copy link
Collaborator

seijihariki commented Dec 19, 2022

Yes, I agree with most of the points. The host really should be locked, and send to img2img is on the way. This is most of a first look to check for basic functionalities and compatibility issues with other installations.

Save not saving metadata is a complicated topic... Considering what would happen when a downloaded canvas contains multiple generations, or even worse, multiple layers.

Even if we only implement this for image generation saving and/or generated resource downloading, this would need to be implemented as manual editing of the image binary exif data, which would be... Unpleasant to say the least.

@wywywywy
Copy link
Author

Yea you're right. Saving metadata is not all that important so let's forget about that for the time being

@seijihariki
Copy link
Collaborator

Just open an issue for this metadata stuff so we don't forget. It probably will stay there for a while, but at least it is on a todo somewhere.

@zero01101
Copy link
Owner

zero01101 commented Dec 19, 2022

kind of irrelevant but regarding the extensions index, seems @ClashSAN may somehow already be aware? https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Extensions#test seems to have come in on this commit

i'm a particular fan of the last entry and am very looking forward it its release :D

@seijihariki
Copy link
Collaborator

seijihariki commented Dec 19, 2022

Oh god, it's almost scary how effective whatever he is doing is in finding extensions! The new repo was barely twelve hours old, and he included it in the wiki.

[edit]
Yeah, that last entry is quite unique in terms of Stable Diffusion webui extensions. Excited to see where that one goes. Not sure if we will have an update soon, though, considering the last commit date.

@zero01101
Copy link
Owner

Not sure if we will have an update soon, though, considering the last commit date.

MAN MY COWORKER ALWAYS GOES ON ABOUT "OH THIS REPO HASN'T BEEN COMMITTED TO IN 6 YEARS" and i'm just like MAYBE THAT MEANS IT'S PERFECT ALREADY

lil bad pokerface

@seijihariki
Copy link
Collaborator

1. It doesn't really need to ask the user for the server URL. It can just take it from the address bar because when acting as an extension, they'll always be the same

2. When doing "Send to openOutpaint", it should also send the prompt

These two are done. Need to see what we can do about model selection on openOutpaint (how we will handle changes in model on webui and openoutpaint). Sending to image is on the way. Will probably use the select tool for that functionality. (also need to fix some bugs on select tool with the layer system)

@seijihariki
Copy link
Collaborator

seijihariki commented Dec 21, 2022

For the model stuff, I'm thinking of disabling model changing from the openoutpaint ui and updating model text display from the messaging system.

@zero01101
Copy link
Owner

definitely agree that just disabling the model selector in the openOutpaint extension is probably the safest and most "obvious" way to do that

@seijihariki
Copy link
Collaborator

I think, in general, it's safe to consider the current state of the extension as fully functional and stable enough. We can ask @ClashSAN if there are any problems with the way we are updating our submodules and to add it to the main list. Also, create a simple README for the extension repo.

@zero01101
Copy link
Owner

zero01101 commented Dec 22, 2022

i added a tiny little readme with a quick screenshot; it's pretty bare however :/ genuinely not sure if there's a way to ping someone on github aside from mentioning them like we've already done?

@wywywywy
Copy link
Author

wywywywy commented Dec 22, 2022

It'd be a good idea to raise a feature request issue on the A1111 repo to get some visibility & tracking, to have it added to the wiki

@seijihariki
Copy link
Collaborator

@wywywywy Seems like (at)ClashSAN (will not tag him to avoid sending too many notifications) has taken a look at our repo: zero01101/openOutpaint-webUI-extension#1 (comment)

Will keep this issue open for a bit, even if/after the extension is officially added, and close it after implementing proper model selection handling and send to img2img.

@zero01101
Copy link
Owner

WE IN THE BIG LEAGUES NOW 🎉

image

image

@wywywywy
Copy link
Author

Well done lads!

@seijihariki
Copy link
Collaborator

WE IN THE BIG LEAGUES NOW 🎉

image

image

🎉🎉🎉

@zero01101
Copy link
Owner

think i can probably safely close this issue now ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants