From d4eb861247ff43294355694403512af8d88195ad Mon Sep 17 00:00:00 2001 From: xmodo <xmodo> Date: Thu, 14 Sep 2023 19:37:42 -0400 Subject: [PATCH] add restore faces option for AI --- js/003-data/gameVariableData.js | 1 + src/art/genAI/stableDiffusion.js | 4 ++++ src/gui/options/options.js | 3 +++ 3 files changed, 8 insertions(+) diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 9e1bf105ccc..942965a8efe 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -181,6 +181,7 @@ App.Data.defaultGameStateVariables = { aiSamplingMethod: "DPM++ 2M SDE Karras", aiSamplingSteps: 20, aiStyle: 1, + aiRestoreFaces: true, aiUpscale: true, aiUpscaleScale: 1.7, aiUpscaler: "SwinIR_4x", diff --git a/src/art/genAI/stableDiffusion.js b/src/art/genAI/stableDiffusion.js index ad687116056..21fd3bc4cd8 100644 --- a/src/art/genAI/stableDiffusion.js +++ b/src/art/genAI/stableDiffusion.js @@ -14,6 +14,7 @@ App.Art.GenAI.StableDiffusionSettings = class { * @param {number} [cfg_scale=5.5] * @param {number} [width=512] * @param {number} [height=768] + * @param {boolean} [restore_faces=true] Whether to use a model to restore faces or not * @param {string} [negative_prompt=""] * @param {string[]} [override_settings=["Discard penultimate sigma: True"]] */ @@ -35,6 +36,7 @@ App.Art.GenAI.StableDiffusionSettings = class { width = 512, height = 768, negative_prompt = "", + restore_faces = true, override_settings = { "always_discard_next_to_last_sigma": true, }, @@ -59,6 +61,7 @@ App.Art.GenAI.StableDiffusionSettings = class { this.width = width; this.height = height; this.negative_prompt = negative_prompt; + this.restore_faces = restore_faces this.override_strings = override_settings; this.override_settings_restore_afterwards = true; } @@ -208,6 +211,7 @@ App.Art.GenAI.StableDiffusionClient = class { seed: slave.natural.artSeed, steps: V.aiSamplingSteps, width: V.aiWidth, + restore_faces: V.aiRestoreFaces }); return settings; diff --git a/src/gui/options/options.js b/src/gui/options/options.js index 494e66f38ba..2d7b21e833c 100644 --- a/src/gui/options/options.js +++ b/src/gui/options/options.js @@ -1277,6 +1277,9 @@ App.UI.artOptions = function() { .addComment("The height of the image."); options.addOption("Width", "aiWidth").showTextBox() .addComment("The width of the image."); + options.addOption("Restore Faces", "aiRestoreFaces") + .addValue("Enabled", true).on().addValue("Disabled", false).off() + .addComment("Use a model to restore the faces after the image has been generated."); options.addOption("Upscaling/highres fix", "aiUpscale") .addValue("Enabled", true).on().addValue("Disabled", false).off() .addComment("Use AI upscaling to produce higher-resolution images. Significantly increases both time to generate and image quality."); -- GitLab