Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions scripts/flux-auto-workflow/flux-auto-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const customStyle = [

const version = "v4.3";
var promptsSource = pipeline.prompts.prompt;
var negativePromptSource = pipeline.prompts.negativePrompt;

const themePreview = [
"data:image/png;base64,/9j/7gAhQWRvYmUAZIAAAAABAwAQAwIDBgAAAAAAAAAAAAAAAP/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8IAEQgAgACAAwEiAAIRAQMRAf/EAMYAAQEAAwEBAQAAAAAAAAAAAAABAgQFBgMHAQEAAwEBAQAAAAAAAAAAAAAAAQIEAwUGEAABAwQBBQABBAMAAAAAAAACAQMEABIyBQYQIDARMRMhIjMVFCUWEQACAQIDBQQGBwUJAAAAAAABAgMABBExEiFxIjITEEIjBSBRsVJicjBBYYGCcxSiM2ODBvCRksJDU6NEFRIAAgAEBAMFBwUAAAAAAAAAAQIAESEiIDESAzAyQhBBUWFxgVJicpITBLGCouIj/9oADAMBAQIRAxEAAADwpCoKgqCoKgqCpRLAAAnUhzHS5hRIBZRLAYl7XT9Lzr5z0n25mXRt8bf61H5jofoHmN1eOlvzWUSwY5Yy9J6HDa3+HzOhwMcnod7zXz+lPY+evuY6L8DLHLNgWWCWDHLGX6X5PDteh5GGHQ1rcuOXL9Zrbfzzrbz2WOXHzVlglglHW9N4PPTk9Dfjsd+HMv21cv0O9zdJThKUzrKJYAASkxFJCACyiURRFEURRFEUSh//2gAIAQIAAQUA8aqiIioqdslXmlRz8r5OE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RfYKKNsxwIPqI2q1HbqJ2E5bOz7z7e0b6O/tIO0HYaWy82h60C7Fm2nDDh1Po0yJw8DtHSPbFGgwAQx4FABkq6ato7eV4YyrOTGcCXBw2t8K92r158P1EUTxSkDAEgArJh/EQ1CI/wB5Iqqp9WCgs1OsjFwCMGY4kEjlou7BEGbMcBTRWoODDAznZsOfTX/NQAyGXaN9Hf6Jls5TCx5lG1G/MjPC1C282j/Tvjik6cgbLWrHV0vjR/DeruG2JcSRu7ythi7EAaho4FRVHBoqLrkoEVWWVcOE6cG1a+HSy10bFOoFx42PDieZ2bmkatdw5kYZA7FHyJ6I30d/pvBFKyQyjCSIHhI+Xu/hpUmkaREGCocgB9ne9Mb6O/6cb6O/6cb6Ow5+qsjWRrI1kayNZGsjWRrI1kayNZGsjWRobDn6q//Z",
Expand Down Expand Up @@ -1918,6 +1919,7 @@ if (batchCount > 20) {
}

var prompts = pipeline.prompts.prompt;
var negativePrompt = "";
if (workflow == 0 || workflow == 1) {
const promptsInput = requestFromUser(
`Flux Auto Workflow ${version}`,
Expand All @@ -1928,15 +1930,18 @@ if (workflow == 0 || workflow == 1) {
"❖ Prompt Setting",
" • Support multiple prompts batch generation, a blank line between each prompt.\n • Use ⬆︎ Shift + ↵ Enter to break line. iPadOS / iOS requires an external keyboard.",
[
this.textField(promptsSource, " Write your prompts here.", true, 410),
this.textField(promptsSource, " Write your prompts here.", true, 300),
this.textField(negativePromptSource," Write your negative prompt here.", true, 50),
this.slider(batchCount, this.slider.fractional(0), 1, maxCount, "❖ Batch count of each prompt")
]
)
];
}
);
// Grab all the inputs for use later.
prompts = promptsInput[0][0];
batchCount = promptsInput[0][1];
negativePrompt = promptsInput[0][1];
batchCount = promptsInput[0][2];
}
const promptsArray = prompts.split('\n\n').filter(prompts => prompts.trim() !== '');
const promptsCount = promptsArray.length;
Expand Down Expand Up @@ -2237,7 +2242,7 @@ if (workflow == 0) {
} else {
configuration.guidanceScale = 4.5;
}
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: null });
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: negativePrompt });
} else if (mode == 1) {
console.log(`🟠 Balance Mode ‣ ❶ Running the Flux Dev ⚙︎ Image batch progress ‣ ${completedBatches}/${totalBatches}${eTime} `);
schnellLora = loras;
Expand All @@ -2249,7 +2254,7 @@ if (workflow == 0) {
configuration.sampler = 15;
configuration.shift = 1.0;
configuration.steps = 4;
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: null });
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: negativePrompt });
console.log(`🟠 Balance Mode ‣ ❷ Refining the image ⚙︎ Image batch progress ‣ ${completedBatches}/${totalBatches}${eTime} `);
if (detail == 0) {
configuration.loras = [];
Expand All @@ -2267,7 +2272,7 @@ if (workflow == 0) {
configuration.steps = 8;
}
configuration.controls = [];
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: null });
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: negativePrompt });
} else if (mode == 2) {
console.log(`🔴 Quality Mode ‣ Running the Flux Dev ⚙︎ Image batch progress ‣ ${completedBatches}/${totalBatches}${eTime}`);
configuration.controls = controls;
Expand All @@ -2285,7 +2290,7 @@ if (workflow == 0) {
configuration.guidanceScale = 3.5;
configuration.steps = 20;
}
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: null });
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: negativePrompt });
}
}
}
Expand All @@ -2296,7 +2301,7 @@ if (workflow == 0) {
const completedBatches = batchCount * s + i + 1;
const eTime = completedBatches > 1 ? estimateTime(start, completedBatches - 1, totalBatches) : ``;
console.log(`🟢 Running the ${currentModel} ⚙︎ Image batch progress ‣ ${completedBatches}/${totalBatches}${eTime}`);
pipeline.run({ configuration: configuration, prompt: promptsArray[s] });
pipeline.run({ configuration: configuration, prompt: promptsArray[s], negativePrompt: negativePrompt });
}
}
} else if (workflow == 2) {
Expand Down