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

Feature Request: Loading log file to populate UI #3

Closed
theelefant opened this issue Aug 16, 2023 · 30 comments
Closed

Feature Request: Loading log file to populate UI #3

theelefant opened this issue Aug 16, 2023 · 30 comments

Comments

@theelefant
Copy link

Given that we now have a log file, wouldn't it be nice to populate the UI directly from that file?

@barepixels
Copy link

Log files have a list of generated inages. How would it knows which one you want to load. Better would be load a specific PNG with metada

@MoonRide303
Copy link
Owner

@theelefant log file is feature added by original Fooocus author and he mentioned still working on it. But temporary HTML file aren't really most convenient way for loading prompt from them, so I don't think this log file will be used like that.

I like the general idea, though, so (when I'll have some spare time) I will look into ComfyUI and try figuring out how loading settings from PNG / JSON files is done there (as well as restoring previous session state). But Comfy uses different UI framework, and it might not so trivial to port this functionality to Fooocus - so no promises.

@theelefant
Copy link
Author

theelefant commented Aug 16, 2023

Log files have a list of generated inages. How would it knows which one you want to load. Better would be load a specific PNG with metada

@barepixels I was referring to the JSON log introduced by this repository and not the HTML one from the original repository.

@That-Dude
Copy link

It would be convenient to just drag a PNG generated with your fork into the GUI and have it populated, that's the expected behaviour from the current userbase.

@MoonRide303
Copy link
Owner

@That-Dude Yeah, I really liked that in ComfyUI myself (as well as remembering UI state after the restart) - those are really nice quality-of-life features in Comfy :).

@barepixels
Copy link

vote

@MoonRide303
Copy link
Owner

@barepixels I have initial version of loading prompt parameters from both JSON and PNG files working - should be ready to use today or tomorrow.

@barepixels
Copy link

Dude, you are my hero

@theelefant
Copy link
Author

@barepixels I have initial version of loading prompt parameters from both JSON and PNG files working - should be ready to use today or tomorrow.

@MoonRide303 Awesome! Many thanks!

@MoonRide303
Copy link
Owner

Just merged into moonride-main. It should work on metadata saved by current version, but might not be compatible with images generated with older versions. Let me know if it works for you.

@barepixels
Copy link

barepixels commented Aug 17, 2023

REPORTING
After updating, I generate a new image. Then quit/relaunch Fooocus
Load the latest generate PNG.
All settings restored :-)

But three didn't
Advance check box is unchecked before it was set as check
Image Number is at 2, before it was set at 1
Save Metadata is set at Disable before it was set at PNG

It's kinda annoying having to change those three EVERYTIME I launch Fooocus. Not elegant and time waster

@barepixels
Copy link

barepixels commented Aug 17, 2023

Am happy to report: Using "deference mode" in Photoshop to compare. The image generated before and image generated after loading PNG are exactly the same, down to pixel level

You did great MoonRide303. Thank you

@MoonRide303
Copy link
Owner

MoonRide303 commented Aug 17, 2023

@barepixels Settings like Saving metadata option, and number of generated images are related to UI itself, not particular prompt / image. I agree it would be nice to have last UI settings automatically restored, but that's a bit different functionality. Btw. I found one bug, related to switch slider value loading - should be fixed now.

@barepixels
Copy link

I will make a feature request at lllyasviel/Fooocus

@That-Dude
Copy link

@barepixels I have initial version of loading prompt parameters from both JSON and PNG files working - should be ready to use today or tomorrow.

You're on fire!

@That-Dude
Copy link

@barepixels Settings like Saving metadata option, and number of generated images are related to UI itself, not particular prompt / image. I agree it would be nice to have last UI settings automatically restored, but that's a bit different functionality. Btw. I found one bug, related to switch slider value loading - should be fixed now.

How about exposing 'save-metadata-on' as a command line switch. Or just default it to on. I think you're flying solo with that patch anyway.

@MoonRide303
Copy link
Owner

MoonRide303 commented Aug 17, 2023

@That-Dude Yeah, it would be useful feature - but I'd rather do it as extension for save/restore UI state made in vanilla Fooocus. Let's first give lllyasviel a chance to speak how he sees it, to avoid duplicating work.

@barepixels
Copy link

barepixels commented Aug 17, 2023

Not wanting to RISK generating images without saving metadata to PNG, I have hard code in Fooocus-MoonRide/webui.py

save_metadata = gr.Radio(label='Save Metadata', choices=['Disabled', 'JSON', 'PNG'], value='PNG')

While at the same file (webui.py) I change the default "Image Number" from 2 to 1

image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=1)

Could not figure how to set "Advanced" to default "Checked"

@MoonRide303
Copy link
Owner

@barepixels If you want to use quick hack, you can change (in webui.py)

                advanced_checkbox = gr.Checkbox(label='Advanced', value=False, container=False)
        with gr.Column(scale=0.5, visible=False) as right_col:

to

                advanced_checkbox = gr.Checkbox(label='Advanced', value=True, container=False)
        with gr.Column(scale=0.5, visible=True) as right_col:

@barepixels
Copy link

barepixels commented Aug 17, 2023

Brother, it works. Thank you

No more annoying having to change these three EVERYTIME I launch Fooocus

Advanced check box is always on
Image Number is at 1
Save Metadata set at PNG as default

@barepixels
Copy link

May I suggest to add a link to this fork at the footer. Or show me how.

link to git hub

@theelefant
Copy link
Author

Could we consider adding a fourth option, "JASON+PNG", in the Advanced Tab?

@That-Dude
Copy link

Jason who? 😀

But those options should probably be tickboxes rather than radio buttons.

@theelefant
Copy link
Author

theelefant commented Aug 18, 2023

Voorhees :)

But yes, tickboxes would be better.

@MoonRide303
Copy link
Owner

Done & merged:
image

@That-Dude
Copy link

Done & merged: image

I'm concerned that you're not getting enough sleep Mr MoonRide :-)

@MoonRide303
Copy link
Owner

@That-Dude Yeah, I could probably use some more of that :).

@barepixels You can check out latest version of moonride-main - I've added loading basic UI settings from JSON file (settings.json), it looks like that:
{"advanced_mode": false, "image_number": 2, "save_metadata_json": false, "save_metadata_png": false}
you can set your preferred values there, instead of having to edit the code.

@barepixels
Copy link

barepixels commented Aug 18, 2023

settings.json work. However, I did have to change the file name from settings-example.json to settings.json

After making changes to settings.json, one must quit/relaunch run-moonride.bat

@barepixels
Copy link

barepixels commented Aug 18, 2023

TIP: When load metadata from PNG one must make sure the "Random" check box is unchecked to insure the original seed is being used.

I suppose when choosing to load metadata from PNG "Random" checkbox should be automatically set as unchecked. But this is not a high priority for me.

Also wish to confirm metadata from yesterday's generated PNG still working.

@MoonRide303
Copy link
Owner

MoonRide303 commented Aug 18, 2023

@barepixels Good catch - I just corrected this random seed checkbox - should automatically untick now after loading prompt files (either PNG or JSON) that include seed value. Sample settings file is provided under different name is to avoid conflicts with changes coming from git to that file (which would happen if settings.json was edited locally by you, and then I would add some more fields to it, etc.).

Seems to be working pretty fine now, so... I am closing it :).

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

No branches or pull requests

4 participants