Coder Social home page Coder Social logo

Comments (7)

medledan avatar medledan commented on May 28, 2024 2

It's not quite that simple. The styles button reads the values from predefined 2 textboxes (prompt/neg prompt), but config presets needs to accept a variable number of arguments because it works with both txt2img and img2img tabs. To do this we need to make use of a coding trick with *args and anonymous functions. Combined with Gradio being really stupid with how their dropdowns work, desyncs happen between server and client, and I couldn't find a way to fix that desync.

Can you just get it to save the config and let us know its not usable until we restart the UI? I'm usually in the middle of something and restarting the UI interrupts me so I rarely ever create any preconfigs.

from config-presets.

Zyin055 avatar Zyin055 commented on May 28, 2024

There's some trickery going on with the code that was causing issues, and the only way I could figure out how to resolve it was to restart the UI after creating a new config preset. It should be possible to do it without a restart like before A1111's update a few weeks ago, but I couldn't get it to work after the update.

from config-presets.

Jonseed avatar Jonseed commented on May 28, 2024

Maybe you could look at the way styles are being saved, and copy that method?

from config-presets.

Zyin055 avatar Zyin055 commented on May 28, 2024

It's not quite that simple. The styles button reads the values from predefined 2 textboxes (prompt/neg prompt), but config presets needs to accept a variable number of arguments because it works with both txt2img and img2img tabs. To do this we need to make use of a coding trick with *args and anonymous functions. Combined with Gradio being really stupid with how their dropdowns work, desyncs happen between server and client, and I couldn't find a way to fix that desync.

from config-presets.

Symbiomatrix avatar Symbiomatrix commented on May 28, 2024

@medledan You need to comment out this function (line ~600) in config_presets (add # before each line):

save_button.click(  # need this to runa after save_config()
                             fn=None,
                             _js="config_preset_settings_restart_gradio()",  # restart Gradio
                             )

All new presets will show up after a reset, and existing preset changes will take effect immediately, which isn't half bad.

@Zyin055 I've been plagued by basically the same thing in regional prompter's presets - the menu item is added to the dropdown with gr.update, but it isn't recognised by the selection event. Are you aware of any fix in recent gradio versions / issue opened in the repo on the matter?

from config-presets.

Symbiomatrix avatar Symbiomatrix commented on May 28, 2024

So I think I've located the cause for this in gradio-app/gradio#4210 ; the simple workaround is updating the dropdown with a persistent list object, same one its choices are inited with. You can check the PR / commit in regional prompter for details, my testing has shown it's working perfectly so far, no restart needed.

from config-presets.

Zyin055 avatar Zyin055 commented on May 28, 2024

Fixed with PR #41

from config-presets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.