mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
Emoji are not being sorted correctly #192
This commit is contained in:
parent
ee8a6fa89f
commit
6f678ec79c
@ -6,6 +6,7 @@ import re
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image, ImageFont, ImageDraw, PngImagePlugin
|
from PIL import Image, ImageFont, ImageDraw, PngImagePlugin
|
||||||
from fonts.ttf import Roboto
|
from fonts.ttf import Roboto
|
||||||
|
import string
|
||||||
|
|
||||||
import modules.shared
|
import modules.shared
|
||||||
from modules.shared import opts
|
from modules.shared import opts
|
||||||
@ -235,6 +236,7 @@ def resize_image(resize_mode, im, width, height):
|
|||||||
|
|
||||||
|
|
||||||
invalid_filename_chars = '<>:"/\\|?*\n'
|
invalid_filename_chars = '<>:"/\\|?*\n'
|
||||||
|
re_nonletters = re.compile(r'[\s'+string.punctuation+']+')
|
||||||
|
|
||||||
|
|
||||||
def sanitize_filename_part(text):
|
def sanitize_filename_part(text):
|
||||||
@ -256,11 +258,11 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
|
|||||||
pnginfo = None
|
pnginfo = None
|
||||||
|
|
||||||
if opts.save_to_dirs and not no_prompt:
|
if opts.save_to_dirs and not no_prompt:
|
||||||
words = re.findall(r'\w+', prompt or "")
|
words = re_nonletters.split(prompt or "")
|
||||||
if len(words) == 0:
|
if len(words) == 0:
|
||||||
words = ["empty"]
|
words = ["empty"]
|
||||||
|
|
||||||
dirname = " ".join(words[0:opts.save_to_dirs_prompt_len])
|
dirname = " ".join(words[0:opts.save_to_dirs_prompt_len]).strip()
|
||||||
path = os.path.join(path, dirname)
|
path = os.path.join(path, dirname)
|
||||||
|
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user