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

Add model preview feature #14

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MindOfMatter
Copy link
Owner

lllyasviel/Fooocus#2029

image

Overview
This PR introduces a significant update to the model preview functionality in the application. The update allows for dynamic generation of model previews based on the last successful image generation attempt. This feature enhances the user experience by providing more relevant and up-to-date previews for models and configurations.

Key Changes

Dynamic Model Preview Generation:

Previews are now generated based on the last successful image attempt, offering a more accurate representation of the current model configuration.
Supports checkpoints and loras models.

Preview Management via JSON:

Previews are managed through preview_log.json files located in the models/checkpoints and models/loras directories.
The JSON files map model filenames to their latest preview images in the output folder.

UI Integration and Tooltip Enhancement:

The UI dynamically loads and displays these previews.
Tooltips are updated to show the latest previews or model filenames.

Configurable via config.py:

New settings in config.py allow for enabling/disabling the cleanup and addition of model previews.
The feature can be controlled via use_cleanup_model_previews and use_add_model_previews settings.

JavaScript and CSS Enhancements:

Refactored JavaScript code for handling model and style previews.
CSS updates for better display and interaction with the new preview functionality.

Error Handling and Debugging:

Added verbose debug outputs for better tracking and resolution of issues.
Ensures robust handling of file existence and JSON data integrity.

Configuration and Usage

Enabling/Disabling Feature:
In config.py, set use_cleanup_model_previews and use_add_model_previews to True or False as needed.

Adding Previews:
Previews are automatically added to the preview_log.json file after each successful generation.

Preview Cleanup:
On app start, the feature cleans up any non-existent outputs referenced in the JSON file.

UI Display:
Previews are displayed in the UI, offering a real-time glimpse of the model's output capabilities.

Additional Notes

First Version Limitation:
In the initial version, an app restart may be required to reflect changes in the previews.

Future Enhancements:
Plans to further refine the feature, including real-time updates without the need for a restart.

How to Test

Generating Images:
Use the application to generate images and observe the automatic update of previews in the UI.

JSON File Updates:
Check preview_log.json files for the correct mapping of model names to the latest image paths.

UI Interaction:
Hover over model names in the UI to see updated previews or tooltips.

@mashb1t
Copy link
Contributor

mashb1t commented Jan 29, 2024

feel free to change the target of this PR to the main branch of Fooocus to contribute back to Fooocus core.

@MindOfMatter
Copy link
Owner Author

feel free to change the target of this PR to the main branch of Fooocus to contribute back to Fooocus core.

I tried but unfortunatly I cant push my new branch as new branch into origin Fooocus target : I dont have the access

mashb1t Can you add me the access to allows to create new branch for new PR into origin Fooocus?

Code_2ZEY52VOb3

@MindOfMatter
Copy link
Owner Author

MindOfMatter commented Feb 8, 2024

#14 (comment)

done and a lot tested

lllyasviel/Fooocus#2211

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.

2 participants