diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-06 20:44:54 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-06 20:44:54 +0000 |
commit | 2995107fa24cfd72b0a991e18271dcde148c2807 (patch) | |
tree | c07b45d3d227d19c682ec6a62f3e7c8cfda3f408 | |
parent | b34b25b4c941819d34f29be6c4c1ec01e64585b4 (diff) | |
download | stable-diffusion-webui-gfx803-2995107fa24cfd72b0a991e18271dcde148c2807.tar.gz stable-diffusion-webui-gfx803-2995107fa24cfd72b0a991e18271dcde148c2807.tar.bz2 stable-diffusion-webui-gfx803-2995107fa24cfd72b0a991e18271dcde148c2807.zip |
added ctrl+up or ctrl+down hotkeys for attention
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | javascript/edit-attention.js | 41 |
2 files changed, 45 insertions, 0 deletions
@@ -16,6 +16,7 @@ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-web - Attention, specify parts of text that the model should pay more attention to
- a man in a ((tuxedo)) - will pay more attention to tuxedo
- a man in a (tuxedo:1.21) - alternative syntax
+ - select text and press ctrl+up or ctrl+down to aduotmatically adjust attention to selected text
- Loopback, run img2img processing multiple times
- X/Y plot, a way to draw a 2 dimensional plot of images with different parameters
- Textual Inversion
@@ -61,6 +62,9 @@ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-web - Reloading checkpoints on the fly
- Checkpoint Merger, a tab that allows you to merge two checkpoints into one
- [Custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts) with many extensions from community
+- [Composable-Diffusion](https://energy-based-model.github.io/Compositional-Visual-Generation-with-Composable-Diffusion-Models/), a way to use multiple prompts at once
+ - separate prompts using uppercase `AND`
+ - also supports weights for prompts: `a cat :1.2 AND a dog AND a penguin :2.2`
## Installation and Running
Make sure the required [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) are met and follow the instructions available for both [NVidia](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs) (recommended) and [AMD](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-AMD-GPUs) GPUs.
diff --git a/javascript/edit-attention.js b/javascript/edit-attention.js new file mode 100644 index 00000000..c67ed579 --- /dev/null +++ b/javascript/edit-attention.js @@ -0,0 +1,41 @@ +addEventListener('keydown', (event) => {
+ let target = event.originalTarget;
+ if (!target.hasAttribute("placeholder")) return;
+ if (!target.placeholder.toLowerCase().includes("prompt")) return;
+
+ let plus = "ArrowUp"
+ let minus = "ArrowDown"
+ if (event.key != plus && event.key != minus) return;
+
+ selectionStart = target.selectionStart;
+ selectionEnd = target.selectionEnd;
+ if(selectionStart == selectionEnd) return;
+
+ event.preventDefault();
+
+ if (selectionStart == 0 || target.value[selectionStart - 1] != "(") {
+ target.value = target.value.slice(0, selectionStart) +
+ "(" + target.value.slice(selectionStart, selectionEnd) + ":1.0)" +
+ target.value.slice(selectionEnd);
+
+ target.focus();
+ target.selectionStart = selectionStart + 1;
+ target.selectionEnd = selectionEnd + 1;
+
+ } else {
+ end = target.value.slice(selectionEnd + 1).indexOf(")") + 1;
+ weight = parseFloat(target.value.slice(selectionEnd + 1, selectionEnd + 1 + end));
+ if (event.key == minus) weight -= 0.1;
+ if (event.key == plus) weight += 0.1;
+
+ weight = parseFloat(weight.toPrecision(12));
+
+ target.value = target.value.slice(0, selectionEnd + 1) +
+ weight +
+ target.value.slice(selectionEnd + 1 + end - 1);
+
+ target.focus();
+ target.selectionStart = selectionStart;
+ target.selectionEnd = selectionEnd;
+ }
+});
|