This commit is contained in:
shadowcz007
2024-03-26 15:14:01 +08:00
parent 41e88824cf
commit 4865f4d148
3 changed files with 22 additions and 8 deletions
+2 -2
View File
@@ -584,8 +584,8 @@ class SwitchByIndex:
}
}
RETURN_TYPES = (any_type,"INT",)
RETURN_NAMES = ("C","count",)
RETURN_TYPES = (any_type,any_type,)
RETURN_NAMES = ("list","count",)
FUNCTION = "run"
+6 -6
View File
@@ -125,7 +125,9 @@ class ImageListReplace:
# 如果image replace 为空
if image_replace==None:
print('如果image replace 为空')
print('如果image replace 为空',images[0])
# [[tensor(
# tensor([[[[0.
first_image=tensor2pil(images[0][0])
width, height = first_image.size
image_replace=Image.new("RGB", (width, height), (0, 0, 0))
@@ -177,8 +179,8 @@ class LoadVideoAndSegment:
CATEGORY = "♾️Mixlab/Video"
RETURN_TYPES = ("IMAGE","IMAGE", "INT","INT",)
RETURN_NAMES = ("segment_batch","segment_list", "frame_count","segment_count",)
RETURN_TYPES = ("IMAGE","IMAGE", "INT",)
RETURN_NAMES = ("segment_batch","frame_count","segment_count",)
FUNCTION = "load_video"
OUTPUT_NODE = True
OUTPUT_IS_LIST = (True,False,False,)
@@ -299,11 +301,9 @@ class LoadVideoAndSegment:
imgs=[torch.from_numpy(np.stack(im)) for im in imgs]
images_list_list = [[image_batch[i:i + 1, ...] for i in range(image_batch.shape[0])] for image_batch in imgs]
# images = torch.from_numpy(np.stack(images))
return (imgs,images_list_list, len(images),len(imgs),)
return (imgs, len(images),len(imgs),)
@classmethod
def IS_CHANGED(s, video, **kwargs):
+14
View File
@@ -98,6 +98,7 @@ function videoUpload (node, inputName, inputData, app) {
}
if (imageWidget.value) {
// console.log(imageWidget.value)
displayDiv.src = `/view?filename=${
imageWidget.value
}&type=input&subfolder=${''}&rand=${Math.random()}`
@@ -221,6 +222,19 @@ app.registerExtension({
if (nodeData?.name == 'LoadVideoAndSegment_') {
nodeData.input.required.upload = ['VIDEOUPLOAD_']
}
},
async loadedGraphNode (node, app) {
if (node.type === 'LoadVideoAndSegment_') {
const imageWidget = node.widgets.find(w => w.name === 'video')
const uploadPreview=node.widgets.find(w=>w.name==='upload-preview')
if (imageWidget.value) {
// console.log(imageWidget.value)
uploadPreview.div.querySelector('video').src = `/view?filename=${
imageWidget.value
}&type=input&subfolder=${''}&rand=${Math.random()}`
}
}
}
})