Add optional reference photo conditioning to Flux generation
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/** Reference conditioning only: the sampler still starts from its empty generated latent. */
|
||||
export function addFluxGenerationReference(graph: Record<string, any>, filename: string) {
|
||||
if (!filename) return
|
||||
graph['reference:load'] = { class_type: 'LoadImage', inputs: { image: filename }, _meta: { title: 'Load reference photo' } }
|
||||
graph['reference:scale'] = { class_type: 'ImageScaleToTotalPixels', inputs: { image: ['reference:load', 0], upscale_method: 'lanczos', megapixels: 1, resolution_steps: 1 }, _meta: { title: 'Scale reference photo' } }
|
||||
graph['reference:encode'] = { class_type: 'VAEEncode', inputs: { pixels: ['reference:scale', 0], vae: ['6', 0] }, _meta: { title: 'Encode reference photo' } }
|
||||
for (const [name, prompt] of [['positive', '9'], ['negative', '10']]) {
|
||||
const id = `reference:${name}`
|
||||
graph[id] = { class_type: 'ReferenceLatent', inputs: { conditioning: [prompt, 0], latent: ['reference:encode', 0] }, _meta: { title: 'Reference photo guidance' } }
|
||||
graph['18'].inputs[name] = [id, 0]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user