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

New run script: selectable preset at launch #1484

Closed
wants to merge 1 commit into from

Conversation

peterng1618
Copy link
Contributor

Added a new run script + batch file:

  • Scan & list all available presets, allowing users to select a preset at launch, eliminating the need to make a new batch file for every new preset.
  • Error handling for invalid inputs.
  • Handling when no presets folder/files are found: launch without preset.

I recognize there are probably more elegant implementations to achieve this goal. This implementation is intended to be non-disruptive to the users who prefer the existing run files. Feel free to refactor as you see fit.

image

Added a new run script that lists all available presets and allows users to select a preset at launch. Eliminating the need to make a new batch file for every new preset
@lllyasviel
Copy link
Owner

Unfortunately this was an already rejected proposal since two months ago or so

@siriume
Copy link

siriume commented Dec 19, 2023

Unfortunately this was an already rejected proposal since two months ago or so

In fact, what we really need is to switch presets within the webui.

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 22, 2023

the config dict can easily be updated after startup by using

if isinstance(preset, str):
preset_path = os.path.abspath(f'./presets/{preset}.json')
try:
if os.path.exists(preset_path):
with open(preset_path, "r", encoding="utf-8") as json_file:
config_dict.update(json.load(json_file))
print(f'Loaded preset: {preset_path}')
else:
raise FileNotFoundError
except Exception as e:
print(f'Load preset [{preset_path}] failed')
print(e)
, but previously used config values have to also be changed everywhere again, which results in every element using a value of the config also having to be re-rendered (reloading the website might be sufficient though).
=> IMHO it's currently easier to just restart the whole application, but the request is understandable.

How do you envision a potential preset change function in the UI to work?

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 23, 2023

Unfortunately this was an already rejected proposal since two months ago or so

In fact, what we really need is to switch presets within the webui.

I've implemented a UI-based solution, which still keeps the preset set in args as default.
You can find it here: #1570

It would be great if you could provide feedback so we can achieve a common goal :)

@siriume
Copy link

siriume commented Dec 25, 2023

the config dict can easily be updated after startup by using

nice!!!

@MindOfMatter
Copy link
Contributor

Hi

I just created a fork fooocus project version just synced with the original project in main branch
https://github.com/MindOfMatter/Fooocus-MindOfMatter-Edition

I created a pr in my fork project to show what we need to change to enable the feature

MindOfMatter/Fooocus-MindOfMatter-Edition#6

If you want to test it, you need to replace your fooocus local folder with mine
(according to selected feature branch)

Also my dev branch contains all merged tested pr features in my fork project
https://github.com/MindOfMatter/Fooocus-MindOfMatter-Edition/tree/dev

I hope that it could help you :)

Have a nice day

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

Successfully merging this pull request may close these issues.

5 participants