diff options
author | unknown <mcgpapu@gmail.com> | 2023-01-28 09:40:51 +0000 |
---|---|---|
committer | unknown <mcgpapu@gmail.com> | 2023-01-28 09:40:51 +0000 |
commit | e79b7db4b47a33889551b9266ee3277879d4f560 (patch) | |
tree | 1c1944204e58e254bfea22ae44edccdbb54e6b3c /modules/styles.py | |
parent | b921a52071cf2a5e551c31a6073af6eaebbf7847 (diff) | |
parent | e8a41df49fadd2cf9f23b1f02d75a4947bec5646 (diff) | |
download | stable-diffusion-webui-gfx803-e79b7db4b47a33889551b9266ee3277879d4f560.tar.gz stable-diffusion-webui-gfx803-e79b7db4b47a33889551b9266ee3277879d4f560.tar.bz2 stable-diffusion-webui-gfx803-e79b7db4b47a33889551b9266ee3277879d4f560.zip |
Merge branch 'master' of github.com:AUTOMATIC1111/stable-diffusion-webui into gamepad
Diffstat (limited to 'modules/styles.py')
-rw-r--r-- | modules/styles.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/styles.py b/modules/styles.py index ce6e71ca..990d5623 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -40,12 +40,18 @@ def apply_styles_to_prompt(prompt, styles): class StyleDatabase:
def __init__(self, path: str):
self.no_style = PromptStyle("None", "", "")
- self.styles = {"None": self.no_style}
+ self.styles = {}
+ self.path = path
- if not os.path.exists(path):
+ self.reload()
+
+ def reload(self):
+ self.styles.clear()
+
+ if not os.path.exists(self.path):
return
- with open(path, "r", encoding="utf-8-sig", newline='') as file:
+ with open(self.path, "r", encoding="utf-8-sig", newline='') as file:
reader = csv.DictReader(file)
for row in reader:
# Support loading old CSV format with "name, text"-columns
|