Skip to content

Commit e98f72b

Browse files
authored
Merge branch 'AUTOMATIC1111:master' into 3825-save-hypernet-strength-to-info
2 parents db5a354 + beb6fc2 commit e98f72b

27 files changed

+2882
-893
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ notification.mp3
2929
/textual_inversion
3030
.vscode
3131
/extensions
32-

javascript/hints.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ titles = {
7575
"Create style": "Save current prompts as a style. If you add the token {prompt} to the text, the style use that as placeholder for your prompt when you use the style in the future.",
7676

7777
"Checkpoint name": "Loads weights from checkpoint before making images. You can either use hash or a part of filename (as seen in settings) for checkpoint name. Recommended to use with Y axis for less switching.",
78+
"Inpainting conditioning mask strength": "Only applies to inpainting models. Determines how strongly to mask off the original image for inpainting and img2img. 1.0 means fully masked, which is the default behaviour. 0.0 means a fully unmasked conditioning. Lower values will help preserve the overall composition of the image, but will struggle with large changes.",
7879

7980
"vram": "Torch active: Peak amount of VRAM used by Torch during generation, excluding cached data.\nTorch reserved: Peak amount of VRAM allocated by Torch, including all active and cached data.\nSys VRAM: Peak amount of VRAM allocation across all applications / total GPU VRAM (peak utilization%).",
8081

javascript/imageviewer.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ function showModal(event) {
1313
}
1414
lb.style.display = "block";
1515
lb.focus()
16+
17+
const tabTxt2Img = gradioApp().getElementById("tab_txt2img")
18+
const tabImg2Img = gradioApp().getElementById("tab_img2img")
19+
// show the save button in modal only on txt2img or img2img tabs
20+
if (tabTxt2Img.style.display != "none" || tabImg2Img.style.display != "none") {
21+
gradioApp().getElementById("modal_save").style.display = "inline"
22+
} else {
23+
gradioApp().getElementById("modal_save").style.display = "none"
24+
}
1625
event.stopPropagation()
1726
}
1827

@@ -81,6 +90,25 @@ function modalImageSwitch(offset) {
8190
}
8291
}
8392

93+
function saveImage(){
94+
const tabTxt2Img = gradioApp().getElementById("tab_txt2img")
95+
const tabImg2Img = gradioApp().getElementById("tab_img2img")
96+
const saveTxt2Img = "save_txt2img"
97+
const saveImg2Img = "save_img2img"
98+
if (tabTxt2Img.style.display != "none") {
99+
gradioApp().getElementById(saveTxt2Img).click()
100+
} else if (tabImg2Img.style.display != "none") {
101+
gradioApp().getElementById(saveImg2Img).click()
102+
} else {
103+
console.error("missing implementation for saving modal of this type")
104+
}
105+
}
106+
107+
function modalSaveImage(event) {
108+
saveImage()
109+
event.stopPropagation()
110+
}
111+
84112
function modalNextImage(event) {
85113
modalImageSwitch(1)
86114
event.stopPropagation()
@@ -93,6 +121,9 @@ function modalPrevImage(event) {
93121

94122
function modalKeyHandler(event) {
95123
switch (event.key) {
124+
case "s":
125+
saveImage()
126+
break;
96127
case "ArrowLeft":
97128
modalPrevImage(event)
98129
break;
@@ -198,6 +229,14 @@ document.addEventListener("DOMContentLoaded", function() {
198229
modalTileImage.title = "Preview tiling";
199230
modalControls.appendChild(modalTileImage)
200231

232+
const modalSave = document.createElement("span")
233+
modalSave.className = "modalSave cursor"
234+
modalSave.id = "modal_save"
235+
modalSave.innerHTML = "🖫"
236+
modalSave.addEventListener("click", modalSaveImage, true)
237+
modalSave.title = "Save Image(s)"
238+
modalControls.appendChild(modalSave)
239+
201240
const modalClose = document.createElement('span')
202241
modalClose.className = 'modalClose cursor';
203242
modalClose.innerHTML = '×'

javascript/ui.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ function switch_to_txt2img(){
4545
return args_to_array(arguments);
4646
}
4747

48-
function switch_to_img2img_img2img(){
48+
function switch_to_img2img(){
4949
gradioApp().querySelector('#tabs').querySelectorAll('button')[1].click();
5050
gradioApp().getElementById('mode_img2img').querySelectorAll('button')[0].click();
5151

5252
return args_to_array(arguments);
5353
}
5454

55-
function switch_to_img2img_inpaint(){
55+
function switch_to_inpaint(){
5656
gradioApp().querySelector('#tabs').querySelectorAll('button')[1].click();
5757
gradioApp().getElementById('mode_img2img').querySelectorAll('button')[1].click();
5858

@@ -65,26 +65,6 @@ function switch_to_extras(){
6565
return args_to_array(arguments);
6666
}
6767

68-
function extract_image_from_gallery_txt2img(gallery){
69-
switch_to_txt2img()
70-
return extract_image_from_gallery(gallery);
71-
}
72-
73-
function extract_image_from_gallery_img2img(gallery){
74-
switch_to_img2img_img2img()
75-
return extract_image_from_gallery(gallery);
76-
}
77-
78-
function extract_image_from_gallery_inpaint(gallery){
79-
switch_to_img2img_inpaint()
80-
return extract_image_from_gallery(gallery);
81-
}
82-
83-
function extract_image_from_gallery_extras(gallery){
84-
switch_to_extras()
85-
return extract_image_from_gallery(gallery);
86-
}
87-
8868
function get_tab_index(tabId){
8969
var res = 0
9070

0 commit comments

Comments
 (0)