From ac91a15aa98ffa678c0645889a7aa9bfb0dc3fd5 Mon Sep 17 00:00:00 2001 From: "M.Hosoi" Date: Thu, 23 Mar 2023 09:20:10 +0900 Subject: [PATCH 1/2] fix: can't get file size if gnubin/stat is already installed in homebrew --- scripts/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 5b1be7f4..495e9950 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -31,7 +31,7 @@ EOF filesize() { case "$(uname -s)" in Linux*) stat -c "%s" $1;; - Darwin*) stat -f "%z" $1;; + Darwin*) /usr/bin/stat -f "%z" $1;; *) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit esac } From 20ad0d7f8cdcc12532290277ea6f7525fa46f5b4 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 23 Mar 2023 09:48:40 +0530 Subject: [PATCH 2/2] Merge pull request #1048 from JeLuF/base36 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔥Hotfix: Avoid name clashes for autosave files --- ui/easydiffusion/utils/save_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/easydiffusion/utils/save_utils.py b/ui/easydiffusion/utils/save_utils.py index b4a85538..6012bc44 100644 --- a/ui/easydiffusion/utils/save_utils.py +++ b/ui/easydiffusion/utils/save_utils.py @@ -1,11 +1,11 @@ import os import time -import base64 import re from easydiffusion.types import TaskData, GenerateImageRequest from sdkit.utils import save_images, save_dicts +from numpy import base_repr filename_regex = re.compile("[^a-zA-Z0-9._-]") @@ -121,8 +121,7 @@ def make_filename_callback(req: GenerateImageRequest, suffix=None, now=None): now = time.time() def make_filename(i): - img_id = base64.b64encode(int(now + i).to_bytes(8, "big")).decode() # Generate unique ID based on time. - img_id = img_id.translate({43: None, 47: None, 61: None})[-8:] # Remove + / = and keep last 8 chars. + img_id = base_repr(int(now * 10000), 36)[-7:] + base_repr(int(i),36) # Base 36 conversion, 0-9, A-Z prompt_flattened = filename_regex.sub("_", req.prompt)[:50] name = f"{prompt_flattened}_{img_id}"