aboutsummaryrefslogtreecommitdiff
path: root/modules/ui_tempdir.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-24 11:09:04 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-24 11:09:04 +0300
commit189229bbf9276fb73e48c783856b02fc57ab5c9b (patch)
tree728b1ab97fec6d18a1ec687ba552ca83b0dcf109 /modules/ui_tempdir.py
parent31f2be3dcedf85c036c5f784c640208d122b62ed (diff)
parentb6c02174050b2c5dd98bf24c797e85ff269516f5 (diff)
Merge branch 'dev' into release_candidate
Diffstat (limited to 'modules/ui_tempdir.py')
-rw-r--r--modules/ui_tempdir.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/ui_tempdir.py b/modules/ui_tempdir.py
index fb75137e..85015db5 100644
--- a/modules/ui_tempdir.py
+++ b/modules/ui_tempdir.py
@@ -44,6 +44,8 @@ def save_pil_to_file(self, pil_image, dir=None, format="png"):
if shared.opts.temp_dir != "":
dir = shared.opts.temp_dir
+ else:
+ os.makedirs(dir, exist_ok=True)
use_metadata = False
metadata = PngImagePlugin.PngInfo()
@@ -57,8 +59,9 @@ def save_pil_to_file(self, pil_image, dir=None, format="png"):
return file_obj.name
-# override save to file function so that it also writes PNG info
-gradio.components.IOComponent.pil_to_temp_file = save_pil_to_file
+def install_ui_tempdir_override():
+ """override save to file function so that it also writes PNG info"""
+ gradio.components.IOComponent.pil_to_temp_file = save_pil_to_file
def on_tmpdir_changed():