StableStudio icon indicating copy to clipboard operation
StableStudio copied to clipboard

Make a basic implement for webui plugin

Open jtydhr88 opened this issue 1 year ago • 14 comments

hi Stability team, I am not sure you guys already start to implement the webui plugin or not, but I make a basic version for this big demand. please let me know how you think about it.

jtydhr88 avatar May 19 '23 06:05 jtydhr88

Hello! 👋

We haven't been able to pick this up yet, so I'd be extremely happy to help you get it finished and merged!

cruhl avatar May 19 '23 15:05 cruhl

Thanks! I make a TODO list in the issue https://github.com/Stability-AI/StableStudio/issues/25 and readme, please feel free to request any features I missed.

jtydhr88 avatar May 19 '23 15:05 jtydhr88

How would you like us to cooperate with you?

Should we create a branch which pulls in from yours, commit directly to yours, etc.?

cruhl avatar May 19 '23 15:05 cruhl

I think it is ok to commit directly, shall I add someone into my repo?

jtydhr88 avatar May 19 '23 15:05 jtydhr88

@cruhl should be as simple as gh pr checkout 24

KAJdev avatar May 19 '23 15:05 KAJdev

Been playing around with this plugin, and so far it seems to work quite well, although with some major issues that need to be addressed before it can be merged:

issues

  • img2img / masking is not implemented
  • model/sampler seems to lose its state often
  • seed seems to be ignored (not sure if this is webui automatically incrementing seed or not)

possible implementations:

  • history (might be able to implement via https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
    • can pull from a path in settings
  • currently webui needs to be started manually with extra CLI flags.
    • plugin could use path in settings along with a field for extra cli flags to launch webui on startup
    • webui status could replace images generated status

KAJdev avatar May 19 '23 16:05 KAJdev

@Kajdev hey at least its a start right?

budaloops avatar May 19 '23 17:05 budaloops

Thanks for @KAJdev testing, let me add the requirements in the TODO list

jtydhr88 avatar May 19 '23 17:05 jtydhr88

@KAJdev @jtydhr88 @daryllaro Taking a crack at this now

cruhl avatar May 19 '23 20:05 cruhl

possible implementations:

  • history (might be able to implement via https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)

    • can pull from a path in settings
  • currently webui needs to be started manually with extra CLI flags.

    • plugin could use path in settings along with a field for extra cli flags to launch webui on startup

Wouldn't these two implementations work only in case both StableStudio and SD-webui are on the same host and wouldn't support remote webui?

merodiro avatar May 20 '23 15:05 merodiro

@merodiro since this plug-in is just at start phase, I only have local environment for dev, once we finish the main features, we can test remote host. However in theory, it should support remote host easily

jtydhr88 avatar May 20 '23 16:05 jtydhr88

I just tried it with remote sd-webui and it worked well. ~The only problem I had was that I couldn't load the samplers~ I think I was doing something wrong. it's loading them fine now

merodiro avatar May 20 '23 18:05 merodiro

image When I don't choose a model it displays SDXL as the model used for the generation

merodiro avatar May 20 '23 18:05 merodiro

I believe this is because internally StableStudio defaults to stable-diffusion-xl-beta-v2-2-2 as a model ID for input objects. If you aren't returning one it will just use the default object specified in Generation.Image.Model.StableDiffusionV1.Input.initial. This can be overridden by the plugin providing a default input.

KAJdev avatar May 20 '23 20:05 KAJdev

@jtydhr88 We're going to try to get this merged tomorrow, will be updating some code in a bit 👍

cruhl avatar May 22 '23 21:05 cruhl

@cruhl thanks! I am also making final tests and fixing the bugs I can find

jtydhr88 avatar May 22 '23 21:05 jtydhr88

@cruhl @KAJdev one more thing, in order to get generated images form webui, I created an extension to entend the rest api since webui doesn't provide, see https://github.com/Stability-AI/StableStudio/issues/25 and https://github.com/jtydhr88/sd-webui-StableStudio, please let me know you guys accept this solution or not

jtydhr88 avatar May 22 '23 21:05 jtydhr88

@jtydhr88 Are you cool with the README changes I committed? @KAJdev is making some tweaks to the plugin itself and then we're cool to merge. 🦾

cruhl avatar May 23 '23 19:05 cruhl

Yeah! Readme is good for me!

jtydhr88 avatar May 23 '23 19:05 jtydhr88

@jtydhr88 Refactor is going well, noticing some issues with the history plugin. Looks like get_root_path() is failing since __file__ doesn't exist in exec()ed python code. os.getcwd() should work though.

KAJdev avatar May 23 '23 21:05 KAJdev

@KAJdev thanks for catching, I will fix it soon

jtydhr88 avatar May 23 '23 21:05 jtydhr88

hi @KAJdev as my test, there is an issue happening on get history image, even webui returns the data, but StableSudio sitll keeps loading without show image: image I output the data, and they are all Prmoise: image I have to revert your code regarding this part to my previous one.

Another issue is the status keeps on "Ready without history plugin" even the extension already be here and orks well to return data. (I don't fix it) image

jtydhr88 avatar May 24 '23 00:05 jtydhr88

Yes, I was having issues with the history plugin, the error mentioned before as well as some possible CORS issues. Will investigate more.

Good catch on the async map there, that revert is fine.

KAJdev avatar May 24 '23 00:05 KAJdev

besides this issue, anything else needs to do for this init version? or i am good to merge

jtydhr88 avatar May 24 '23 01:05 jtydhr88

I think we are aiming for an early morning merge.

KAJdev avatar May 24 '23 02:05 KAJdev

@jtydhr88 Are we good to merge this from your perspective?

cruhl avatar May 24 '23 15:05 cruhl

@cruhl yes!

jtydhr88 avatar May 24 '23 15:05 jtydhr88

I really need to thank you @jtydhr88 (@cruhl , @KAJdev ) for bringing this to StableStudio. StableDiffusion now feels so much polished and slick! Of course there are plenty of opportunities for more features like cancel current dreaming, progress bar/eta, set image size, set settings for variants before dreaming... but this first, very important step was really great work. Well done!

SeriousM avatar May 24 '23 21:05 SeriousM