diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-06 09:39:28 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-06 09:39:28 +0000 |
commit | f9950da3e30e6c8e2993d1d69d6e5c26c6a56485 (patch) | |
tree | f5f320fa5fd470859c8f25e3c73ddd1b50ca6899 /modules/shared.py | |
parent | aa42c0ff8e51c1dde50a313aa2c12b357b287b50 (diff) | |
download | stable-diffusion-webui-gfx803-f9950da3e30e6c8e2993d1d69d6e5c26c6a56485.tar.gz stable-diffusion-webui-gfx803-f9950da3e30e6c8e2993d1d69d6e5c26c6a56485.tar.bz2 stable-diffusion-webui-gfx803-f9950da3e30e6c8e2993d1d69d6e5c26c6a56485.zip |
create dir for gradio themes cache if it's missing
Diffstat (limited to 'modules/shared.py')
-rw-r--r-- | modules/shared.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/shared.py b/modules/shared.py index 525371cc..8e1b8063 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -866,10 +866,12 @@ def reload_gradio_theme(theme_name=None): gradio_theme = gr.themes.Default(**default_theme_args)
else:
try:
- theme_cache_path = os.path.join(script_path, 'tmp', 'gradio_themes', f'{theme_name.replace("/", "_")}.json')
+ theme_cache_dir = os.path.join(script_path, 'tmp', 'gradio_themes')
+ theme_cache_path = os.path.join(theme_cache_dir, f'{theme_name.replace("/", "_")}.json')
if opts.gradio_themes_cache and os.path.exists(theme_cache_path):
gradio_theme = gr.themes.ThemeClass.load(theme_cache_path)
else:
+ os.makedirs(theme_cache_dir, exist_ok=True)
gradio_theme = gr.themes.ThemeClass.from_hub(theme_name)
gradio_theme.dump(theme_cache_path)
except Exception as e:
|