Update auto_download.py

This commit is contained in:
iwindy910
2026-01-12 15:13:01 +08:00
committed by GitHub
parent 76ef059763
commit 20bb95f8a2
+6 -2
View File
@@ -3,6 +3,7 @@ import numpy as np
from PIL import Image
import io
import base64
import datetime
from server import PromptServer
class AutoDownloadNode:
@@ -25,6 +26,9 @@ class AutoDownloadNode:
def transmit_to_client(self, image, filename_prefix):
ui_images = []
now = datetime.datetime.now()
timestamp = now.strftime("%y_%m%d_%H%M_%S")
for index, img_tensor in enumerate(image):
i = 255. * img_tensor.cpu().numpy()
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
@@ -36,10 +40,10 @@ class AutoDownloadNode:
PromptServer.instance.send_sync("auto_download_direct", {
"data": img_base64,
"filename": f"{filename_prefix}_{index:05d}.png"
"filename": f"{filename_prefix}_{timestamp}_{index:02d}.png"
})
return {"ui": {"images": []}}
NODE_CLASS_MAPPINGS = {"AutoDownloadNode": AutoDownloadNode}
NODE_DISPLAY_NAME_MAPPINGS = {"AutoDownloadNode": "AutoDownload2Client"}
NODE_DISPLAY_NAME_MAPPINGS = {"AutoDownloadNode": "AutoDownload2Client"}