richrobber2 / canvas-zoom

zoom and pan functionality
350 stars 23 forks source link

Erase Mask #102

Open richrobber2 opened 8 months ago

richrobber2 commented 8 months ago

Description

I've encountered significant challenges attempting to customize the Gradio frontend. The main issue arises from the need to modify the frontend without direct access to the source code, compounded by the limitations imposed by Svelte's state management system.

Issue Details

Gradio's frontend, being managed with Svelte, encapsulates its state in a way that external updates through plain JavaScript are reset due to the state being internally managed. This encapsulation prevents any third-party updates from persisting, as the variables controlling the state are not exposed for importation in JavaScript files.

Additionally, my attempts to run the build_frontend.sh script to modify the source in its uncompiled state were unsuccessful. This has effectively barred me from making the necessary changes and recompiling the code into the required Svelte format.

Attempts to Resolve

Request

Given these challenges, I am reaching out for assistance in modifying and compiling the Gradio frontend source. The specific features I'm looking to integrate include Eraser for the mask, so that you can better make masks. and a button to invert the mask for ease of use. which are currently hindered by the aforementioned issues.

i can work on making the actual code if you think you can help me. i think its worth editing the source code of gradio. and since we already do it to some files i see no reason we cant do it. i can code the functionallity if you can compile it for me

@daswer123

daswer123 commented 8 months ago

Hi, a long time ago I did a little tutorial on how to modify gradio sources. here

Regarding the query, I've tried doing the erase functionality and modifying the mask in various ways before. The only normal thing I managed to do after many attempts was to make the fill functionality on X. Also after a while, I realize that continuing to modify the source code is not the best idea, although it has shown good results.

The new gradio 4.x has a large set of built-in tools for inpaint and sketch, such as erase, layers, etc. It might be worth waiting for webui to be updated to gradio 4.x

https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14184

https://github.com/richrobber2/canvas-zoom/assets/22278673/fb487e75-825c-49c4-990d-e58fa6b46bb4

richrobber2 commented 8 months ago

yes i tried to modify them through the tutorial but the version number that my sd showed was not avalible. and when i tried to run the sh build it failed.

~is that in the dev branch already?~ (nevermind i checked on my own) and do you need any help integrating anything for the new version? maybe we should make a branch for versions from the past. or start using the "release" features for github

i created a new branch for creating updates on v4 gradio update v4

daswer123 commented 8 months ago

yes i tried to modify them through the tutorial but the version number that my sd showed was not avalible. and when i tried to run the sh build it failed.

Well yes, the last time I did this was for gradio version 3.31.

Yes will need to figure out something to make it work well on the old webui on gradio 3.x and on the new 4.x because they have too different structure.

Actually it's too early to do anything, as they can do the webui structure on gradio 4 is not fully finalized yet, I would wait for this PR to be pushed into the dev branch