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

Feat: Add ability to change the Gradio temp path for saving images. Added ability to clear Gradio temp files and folders on launch #1992

Merged
merged 10 commits into from Mar 10, 2024

Conversation

midareashi
Copy link
Contributor

@midareashi midareashi commented Jan 20, 2024

  • Added option to change the Gradio Temp path
  • Added option to delete Gradio Temp images and folders on launch

Changing the temp path is a feature requested by several users. I doubt a lot of users even know Gradio is filling up their appdata folder with temporary images each time they generate. In the future it would be nice to use the image generated in private_logger.py for the completed image and get rid of the duplicate images entirely. Until then...

Delete on launch will only happen when using a custom Gradio Temp path. That will stop this app from removing Gradio Temp images created by other applications.

EDIT @mashb1t: relates to #1924

@midareashi
Copy link
Contributor Author

I would understand if you don't want to include the delete functionality. I just included it since it's what I have been using on my local to keep the temp files off my drive.

@midareashi midareashi changed the title Gradio temp Feat: Add ability to change the Gradio temp path for saving images. Added ability to clear Gradio temp files and folders on launch Jan 22, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented Jan 31, 2024

relates to #1932 where the file of private_logger.py is used as frontend output (but Gradio still somehow creates temp images, even when prividing a filepath)

@mashb1t mashb1t added the Size M medium change, isolated, testing with care label Feb 8, 2024
@mashb1t mashb1t added this to the 2.3.0 milestone Mar 3, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented Mar 5, 2024

@midareashi can you please pull the current main branch into this PR and fix merge conflicts?

@mashb1t mashb1t merged commit 85e8aa8 into lllyasviel:main Mar 10, 2024
mashb1t added a commit that referenced this pull request Mar 10, 2024
mashb1t added a commit that referenced this pull request Mar 10, 2024
mashb1t added a commit that referenced this pull request Mar 10, 2024
* Added options to set the Gradio cache path and clear cache on launch.

* Renamed cache to temp

* clear temp

* feat: do not delete temp folder but only clean content

also use fallback to system temp dir
see https://github.com/gradio-app/gradio/blob/6683ab2589f9d8658e1f51acc1b7526edce988d3/gradio/utils.py#L1151

* refactor: code cleanup

* feat: unify arg --temp-path and new temp_path config value

* feat: change default temp dir from gradio to fooocus

* refactor: move temp path method definition and configs

* feat: rename get_temp_path to init_temp_path

---------

Co-authored-by: Magee <koshms3@gmail.com>
Co-authored-by: steveyourcreativepeople <steve@yourcreativepeople.com>
Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size M medium change, isolated, testing with care
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants