Browse Source

Update LoadImage to new ComfyTypedNode form

pull/333/head
Ionite 1 year ago
parent
commit
d57c04bcb1
No known key found for this signature in database
  1. 4
      StabilityMatrix.Avalonia/ViewModels/Inference/InferenceImageUpscaleViewModel.cs
  2. 17
      StabilityMatrix.Core/Models/Api/Comfy/Nodes/ComfyNodeBuilder.cs

4
StabilityMatrix.Avalonia/ViewModels/Inference/InferenceImageUpscaleViewModel.cs

@ -122,8 +122,8 @@ public class InferenceImageUpscaleViewModel : InferenceGenerationViewModelBase
builder.Connections.PrimarySize = sourceImageSize;
// Load source
var loadImage = nodes.AddNamedNode(
ComfyNodeBuilder.LoadImage("LoadImage", sourceImageRelativePath)
var loadImage = nodes.AddTypedNode(
new ComfyNodeBuilder.LoadImage { Name = "LoadImage", Image = sourceImageRelativePath }
);
builder.Connections.Primary = loadImage.Output1;

17
StabilityMatrix.Core/Models/Api/Comfy/Nodes/ComfyNodeBuilder.cs

@ -310,21 +310,12 @@ public class ComfyNodeBuilder
};
}
public record LoadImage : ComfyTypedNodeBase<ImageNodeConnection, ImageMaskConnection>
{
/// <summary>
/// Create a LoadImage node.
/// Path relative to the Comfy input directory
/// </summary>
/// <param name="name">Name of the node</param>
/// <param name="relativeInputPath">Path relative to the Comfy input directory</param>
public static NamedComfyNode<ImageNodeConnection, ImageMaskConnection> LoadImage(
string name,
string relativeInputPath
)
{
return new NamedComfyNode<ImageNodeConnection, ImageMaskConnection>(name)
{
ClassType = "LoadImage",
Inputs = new Dictionary<string, object?> { ["image"] = relativeInputPath }
};
public required string Image { get; init; }
}
public record PreviewImage : ComfyTypedNodeBase

Loading…
Cancel
Save