lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
7.73k stars 741 forks source link

(Solved) Looking for an "Extensions Expert" #1792

Closed Marc0ai closed 2 weeks ago

Marc0ai commented 3 weeks ago

Forgive me, it's not a real issue, but I didn't know where else to post other than here or reddit....

In short, I've finished writing a script that can be used on Forge (or automatic1111 if you prefer) which works, and it works quite well.

The problem is that so far, the only thing I've managed to do is implement it as a script (you know, the ones you use at the bottom of the WebUI from the dropdown menu), but I would like to "convert" it into a proper extension, so that it appears in the "Main" tab. Despite my attempts, I haven't been able to figure it out, or rather, I don't know how to do it practically. I've only tried emulating other extensions, but without success...

So, is there anyone who could take a look? https://pastebin.com/z3jjxw4x

Feel free to try it out; the script itself works and is used to apply photographic filters to the generations.

DenOfEquity commented 3 weeks ago

First:

    def show(self, is_img2img):
        return scripts.AlwaysVisible

Second: run() is for scripts, for extensions you have many options. Check modules\scripts.py. postprocess_image() seems ideal for you: def postprocess_image(self, p, pp, *script_args): It'll be called for each image, with the image in pp.image. Third: wrap your UI up into a gradio Accordion.

Nice work, BTW!

Marc0ai commented 2 weeks ago

Wow, thanks to your answer I was finally able to figure it out.... I was just using the wrong approach, thanks, I really appreciate it. The next challenge now will be to be able to insert it into the extensions index, because I noticed that the index has not been updated for a month now, so I don't know if there is still interest from the author of A1111.... If anyone still wants to try it, the extension can be completely used and installed from here: https://github.com/Marc0ai/sd-webui-photo-refiner

nitinmukesh commented 2 weeks ago

@Marc0ai

Is there any dependency to be installed like dlib?

Marc0ai commented 2 weeks ago

Yep, to use "Face Enhancer" you need dlib, in theory it should install itself on the first startup

Juqowel commented 2 weeks ago

Yep, to use "Face Enhancer" you need dlib, in theory it should install itself on the first startup

It's not.

err

Marc0ai commented 2 weeks ago

Damn my bad... Evidently there are problems with that installation method... I temporarily added a separate installer, now it should add dlib correctly, let me know

Juqowel commented 2 weeks ago

Installation will be a bit complicated.

cm

Marc0ai commented 2 weeks ago

It should actually be easier than expected, I updated everything and now it should handle installing cmake too, you can try updating the extension and try again

Marc0ai commented 2 weeks ago

I literally started getting interested in python and how to implement it in the webui 3 days ago, so I was expecting this kind of problem, with a little patience I hope to solve everything 👌

Juqowel commented 2 weeks ago

It should actually be easier than expected, I updated everything and now it should handle installing cmake too, you can try updating the extension and try again

cm3

You should test it on a new clean system to find the correct way.

SvenErik1968 commented 2 weeks ago

This looks interesting since I use ReActor and ADetailer a lot, so I manually installed the requirements on my computer (Win 11) before I tried to install the extension, and the extension installed without issues. Going to test it out later tonight.

I suggest you make a wiki page on the Github page with some good examples for each of the various settings and make a link to the wiki visible after you expand it in the UI. That would make it easier for people to get up and running without having to spend potentially a lot of time to test out how it works to find out what results one can expect.

Many would also like to see hints with some short description when you hover over one of the settings similar to this: image

And to make it more visible to other A1111/Forge users, see if you can get it added to the Extension Index.

Marc0ai commented 2 weeks ago

I'm glad the extension is useful and I really appreciate the feedback. I've made some improvements to the UI, including a link to the Git page where I've added visible examples for each effect. I'll add descriptions for the effects later. Unfortunately, I'm still trying to figure out the best way to install the dlib library, which should be quite simple in theory, but it seems to cause issues for some users. If anyone knows more about this, I'd greatly appreciate it. Oh, and I've also forwarded it to the A1111 index, hoping it's still active—I haven't seen any updates in a month... PS: As I already said, it's been just over a week since I learned Python, Gradio etc....I still have a lot of things to understand...🤯