mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
handle en tags with same names as en itself
This commit is contained in:
Submodule extensions-builtin/sd-webui-controlnet updated: d56f1b8bcb...4729f8eb07
@@ -61,15 +61,23 @@ function getCardDetails(...args) {
|
||||
}
|
||||
|
||||
function readCardTags(el, tags) {
|
||||
const replaceOutsideBrackets = (input, target, replacement) => input.split(/(<[^>]*>|\{[^}]*\})/g).map((part, i) => {
|
||||
if (i % 2 === 0) return part.split(target).join(replacement); // Only replace in the parts that are not inside brackets (which are at even indices)
|
||||
return part;
|
||||
}).join('');
|
||||
|
||||
const clickTag = (e, tag) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const textarea = activePromptTextarea[getENActiveTab()];
|
||||
if (textarea.value.indexOf(` ${tag}`) !== -1) textarea.value = textarea.value.replace(` ${tag}`, '');
|
||||
else if (textarea.value.indexOf(`${tag} `) !== -1) textarea.value = textarea.value.replace(` ${tag} `, '');
|
||||
else textarea.value += ` ${tag}`;
|
||||
let new_prompt = textarea.value;
|
||||
new_prompt = replaceOutsideBrackets(new_prompt, ` ${tag}`, ''); // try to remove tag
|
||||
new_prompt = replaceOutsideBrackets(new_prompt, `${tag} `, '');
|
||||
if (new_prompt === textarea.value) new_prompt += ` ${tag}`; // if not removed, then append it
|
||||
textarea.value = new_prompt;
|
||||
updateInput(textarea);
|
||||
};
|
||||
|
||||
if (tags.length === 0) return;
|
||||
const cardTags = tags.split('|');
|
||||
if (!cardTags || cardTags.length === 0) return;
|
||||
|
||||
@@ -55,8 +55,12 @@ def setup_color_correction(image):
|
||||
|
||||
|
||||
def apply_color_correction(correction, original_image):
|
||||
shared.log.debug(f"Applying color correction: correction={correction} image={original_image}")
|
||||
image = Image.fromarray(cv2.cvtColor(exposure.match_histograms(cv2.cvtColor(np.asarray(original_image), cv2.COLOR_RGB2LAB), correction, channel_axis=2), cv2.COLOR_LAB2RGB).astype("uint8"))
|
||||
shared.log.debug(f"Applying color correction: correction={correction.shape} image={original_image}")
|
||||
np_image = np.asarray(original_image)
|
||||
np_recolor = cv2.cvtColor(np_image, cv2.COLOR_RGB2LAB)
|
||||
np_match = exposure.match_histograms(np_recolor, correction, channel_axis=2)
|
||||
np_output = cv2.cvtColor(np_match, cv2.COLOR_LAB2RGB)
|
||||
image = Image.fromarray(np_output.astype("uint8"))
|
||||
image = blendLayers(image, original_image, BlendType.LUMINOSITY)
|
||||
return image
|
||||
|
||||
|
||||
+7
-7
@@ -173,7 +173,7 @@ if cmd_opts.backend is not None: # override with args
|
||||
backend = Backend.DIFFUSERS if cmd_opts.backend.lower() == 'diffusers' else Backend.ORIGINAL
|
||||
if cmd_opts.use_openvino: # override for openvino
|
||||
backend = Backend.DIFFUSERS
|
||||
from modules.intel.openvino import get_device_list as get_openvino_device_list
|
||||
from modules.intel.openvino import get_device_list as get_openvino_device_list # pylint: disable=ungrouped-imports
|
||||
|
||||
|
||||
class OptionInfo:
|
||||
@@ -462,12 +462,12 @@ options_templates.update(options_section(('saving-images', "Image Options"), {
|
||||
"font_color": OptionInfo("#FFFFFF", "Font color", ui_components.FormColorPicker, {}),
|
||||
|
||||
"save_sep_options": OptionInfo("<h2>Intermediate Image Saving</h2>", "", gr.HTML),
|
||||
"save_init_img": OptionInfo(False, "Save img2img init images"),
|
||||
"save_images_before_highres_fix": OptionInfo(False, "Save image before applying hires"),
|
||||
"save_images_before_refiner": OptionInfo(False, "Save image before running refiner"),
|
||||
"save_images_before_face_restoration": OptionInfo(False, "Save image before doing face restoration"),
|
||||
"save_images_before_color_correction": OptionInfo(False, "Save image before applying color correction"),
|
||||
"save_mask": OptionInfo(False, "Save the inpainting greyscale mask"),
|
||||
"save_init_img": OptionInfo(False, "Save init images"),
|
||||
"save_images_before_highres_fix": OptionInfo(False, "Save image before hires"),
|
||||
"save_images_before_refiner": OptionInfo(False, "Save image before refiner"),
|
||||
"save_images_before_face_restoration": OptionInfo(False, "Save image before face restoration"),
|
||||
"save_images_before_color_correction": OptionInfo(False, "Save image before color correction"),
|
||||
"save_mask": OptionInfo(False, "Save inpainting mask"),
|
||||
"save_mask_composite": OptionInfo(False, "Save inpainting masked composite"),
|
||||
}))
|
||||
|
||||
|
||||
+1
-1
Submodule wiki updated: 973a5b0fc1...4142109ce1
Reference in New Issue
Block a user