-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathVAEDecodePreview.py
41 lines (36 loc) · 1.16 KB
/
VAEDecodePreview.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
@author: Manny Gonzalez
@title: 🐯 YFG Comical Nodes
@nickname: 🐯 YFG Comical Nodes
@description: Utility custom nodes for special effects, image manipulation and quality of life tools.
"""
## Based on original code by XSS https://civitai.com/models/24869?modelVersionId=47776 ##
import torch
import nodes
import folder_paths
import comfy.sd
class VAEDecodePreview():
def __init__(self, device="cpu"):
self.device = device
self.output_dir = folder_paths.get_temp_directory()
self.type = "temp"
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"samples": ("LATENT", ),
"vae": ("VAE", )
}
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "decode_preview"
OUTPUT_NODE = True
CATEGORY = "🐯 YFG"
def decode_preview(self, vae, samples):
images = vae.decode(samples["samples"])
saveImages = nodes.SaveImage()
saveImages.output_dir = folder_paths.get_temp_directory()
saveImages.type = "temp"
results = saveImages.save_images(images)
results["result"] = (images, )
return results