Now format sentences too
- Added RE for handling spaces - Added Demo Imagepull/4/head
parent
54d32b9b63
commit
7b849d94d1
|
|
@ -1,6 +1,8 @@
|
|||
# SD Webui Prompt Format
|
||||
This is an Extension for the [Automatic1111 Webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui), which aims to help formatting prompts upon generation.
|
||||
|
||||
<p align="center"><img src="Demo.jpg"></p>
|
||||
|
||||
## What is This ?
|
||||
- Sometimes when you are typing too fast or are copying tags from all over the places, you end up with duplicated spaces or commas.
|
||||
- This simple script helps removing them whenever you click **Generate**.
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ onUiLoaded(async () => {
|
|||
const idP = 'txt2img_prompt'
|
||||
const textareaP = gradioApp().getElementById(idP).querySelector('textarea')
|
||||
const tagsP = textareaP.value.split(',').map(word => word.trim()).filter(word => word !== '');
|
||||
textareaP.value = tagsP.join(', ');
|
||||
const sentenceP = tagsP.join(', ');
|
||||
textareaP.value = sentenceP.replace(/\s+/g, ' ').trim();
|
||||
updateInput(textareaP)
|
||||
const idN = 'txt2img_neg_prompt'
|
||||
const textareaN = gradioApp().getElementById(idN).querySelector('textarea')
|
||||
const tagsN = textareaN.value.split(',').map(word => word.trim()).filter(word => word !== '');
|
||||
textareaN.value = tagsN.join(', ');
|
||||
const sentenceN = tagsN.join(', ');
|
||||
textareaN.value = sentenceN.replace(/\s+/g, ' ').trim();
|
||||
updateInput(textareaN)
|
||||
}
|
||||
})
|
||||
|
|
@ -39,12 +41,14 @@ onUiLoaded(async () => {
|
|||
const idP = 'img2img_prompt'
|
||||
const textareaP = gradioApp().getElementById(idP).querySelector('textarea')
|
||||
const tagsP = textareaP.value.split(',').map(word => word.trim()).filter(word => word !== '');
|
||||
textareaP.value = tagsP.join(', ');
|
||||
const sentenceP = tagsP.join(', ');
|
||||
textareaP.value = sentenceP.replace(/\s+/g, ' ').trim();
|
||||
updateInput(textareaP)
|
||||
const idN = 'img2img_neg_prompt'
|
||||
const textareaN = gradioApp().getElementById(idN).querySelector('textarea')
|
||||
const tagsN = textareaN.value.split(',').map(word => word.trim()).filter(word => word !== '');
|
||||
textareaN.value = tagsN.join(', ');
|
||||
const sentenceN = tagsN.join(', ');
|
||||
textareaN.value = sentenceN.replace(/\s+/g, ' ').trim();
|
||||
updateInput(textareaN)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue