Commit 03738668 authored by Robin Fernandes's avatar Robin Fernandes

Merge from master

parents 25eb1e3d 19fc3e82
......@@ -76,6 +76,10 @@ sudo pacman -S wget git python3
bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
```
### Installation on Apple Silicon
Find the instructions [here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon).
## Documentation
The documentation was moved from this README over to the project's [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki).
......
......@@ -18,9 +18,9 @@ function dimensionChange(e,dimname){
return;
}
var img2imgMode = gradioApp().querySelector("input[name=radio-img2img_mode]:checked")
var img2imgMode = gradioApp().querySelector('#mode_img2img.tabs > div > button.rounded-t-lg.border-gray-200')
if(img2imgMode){
img2imgMode=img2imgMode.value
img2imgMode=img2imgMode.innerText
}else{
return;
}
......@@ -30,12 +30,10 @@ function dimensionChange(e,dimname){
var targetElement = null;
if(img2imgMode=='Redraw whole image' && redrawImage){
if(img2imgMode=='img2img' && redrawImage){
targetElement = redrawImage;
}else if(img2imgMode=='Inpaint a part of image' && inpaintImage){
}else if(img2imgMode=='Inpaint' && inpaintImage){
targetElement = inpaintImage;
}else if(img2imgMode=='SD upscale' && redrawImage){
targetElement = redrawImage;
}
if(targetElement){
......@@ -119,6 +117,3 @@ onUiUpdate(function(){
})
}
});
......@@ -59,6 +59,7 @@ titles = {
"Images filename pattern": "Use following tags to define how filenames for images are chosen: [steps], [cfg], [prompt], [prompt_spaces], [width], [height], [sampler], [seed], [model_hash], [prompt_words], [date]; leave empty for default.",
"Directory name pattern": "Use following tags to define how subdirectories for images and grids are chosen: [steps], [cfg], [prompt], [prompt_spaces], [width], [height], [sampler], [seed], [model_hash], [prompt_words], [date]; leave empty for default.",
"Max prompt words": "Set the maximum number of words to be used in the [prompt_words] option; ATTENTION: If the words are too long, they may exceed the maximum length of the file path that the system can handle",
"Loopback": "Process an image, use it as an input, repeat.",
"Loops": "How many times to repeat processing an image and using it as input for the next iteration",
......
/**
* temporary fix for https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/668
* @see https://github.com/gradio-app/gradio/issues/1721
*/
window.addEventListener( 'resize', () => imageMaskResize());
function imageMaskResize() {
const canvases = gradioApp().querySelectorAll('#img2maskimg .touch-none canvas');
if ( ! canvases.length ) {
canvases_fixed = false;
window.removeEventListener( 'resize', imageMaskResize );
return;
}
const wrapper = canvases[0].closest('.touch-none');
const previewImage = wrapper.previousElementSibling;
if ( ! previewImage.complete ) {
previewImage.addEventListener( 'load', () => imageMaskResize());
return;
}
const w = previewImage.width;
const h = previewImage.height;
const nw = previewImage.naturalWidth;
const nh = previewImage.naturalHeight;
const portrait = nh > nw;
const factor = portrait;
const wW = Math.min(w, portrait ? h/nh*nw : w/nw*nw);
const wH = Math.min(h, portrait ? h/nh*nh : w/nw*nh);
wrapper.style.width = `${wW}px`;
wrapper.style.height = `${wH}px`;
wrapper.style.left = `${(w-wW)/2}px`;
wrapper.style.top = `${(h-wH)/2}px`;
canvases.forEach( c => {
c.style.width = c.style.height = '';
c.style.maxWidth = '100%';
c.style.maxHeight = '100%';
c.style.objectFit = 'contain';
});
}
onUiUpdate(() => imageMaskResize());
\ No newline at end of file
......@@ -249,7 +249,6 @@ invalid_filename_prefix = ' '
invalid_filename_postfix = ' .'
re_nonletters = re.compile(r'[\s'+string.punctuation+']+')
max_filename_part_length = 128
max_prompt_words = 8
def sanitize_filename_part(text, replace_spaces=True):
......@@ -263,6 +262,8 @@ def sanitize_filename_part(text, replace_spaces=True):
def apply_filename_pattern(x, p, seed, prompt):
max_prompt_words = opts.directories_max_prompt_words
if seed is not None:
x = x.replace("[seed]", str(seed))
......
......@@ -118,4 +118,8 @@ def img2img(mode: int, prompt: str, negative_prompt: str, prompt_style: str, pro
shared.total_tqdm.clear()
return processed.images, processed.js(), plaintext_to_html(processed.info)
generation_info_js = processed.js()
if opts.samples_log_stdout:
print(generation_info_js)
return processed.images, generation_info_js, plaintext_to_html(processed.info)
\ No newline at end of file
This diff is collapsed.
......@@ -44,5 +44,9 @@ def txt2img(prompt: str, negative_prompt: str, prompt_style: str, prompt_style2:
shared.total_tqdm.clear()
return processed.images, processed.js(), plaintext_to_html(processed.info)
generation_info_js = processed.js()
if opts.samples_log_stdout:
print(generation_info_js)
return processed.images, generation_info_js, plaintext_to_html(processed.info)
......@@ -22,7 +22,6 @@ from modules.paths import script_path
from modules.shared import opts, cmd_opts
import modules.shared as shared
from modules.sd_samplers import samplers, samplers_for_img2img
import modules.realesrgan_model as realesrgan
import modules.ldsr_model
import modules.scripts
import modules.gfpgan_model
......@@ -814,9 +813,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
return comp(label=info.label, value=fun, **(args or {}))
components = []
keys = list(opts.data_labels.keys())
settings_cols = 3
items_per_col = math.ceil(len(keys) / settings_cols)
def run_settings(*args):
up = []
......@@ -842,20 +838,33 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
settings_submit = gr.Button(value="Apply settings", variant='primary')
result = gr.HTML()
settings_cols = 3
items_per_col = int(len(opts.data_labels) * 0.9 / settings_cols)
cols_displayed = 0
items_displayed = 0
previous_section = None
column = None
with gr.Row(elem_id="settings").style(equal_height=False):
for colno in range(settings_cols):
with gr.Column(variant='panel'):
for rowno in range(items_per_col):
index = rowno + colno * items_per_col
for i, (k, item) in enumerate(opts.data_labels.items()):
if index < len(keys):
components.append(create_setting_component(keys[index]))
if previous_section != item.section:
if cols_displayed < settings_cols and (items_displayed >= items_per_col or previous_section is None):
if column is not None:
column.__exit__()
settings_submit.click(
fn=run_settings,
inputs=components,
outputs=[result]
)
column = gr.Column(variant='panel')
column.__enter__()
items_displayed = 0
cols_displayed += 1
previous_section = item.section
gr.HTML(elem_id="settings_header_text_{}".format(item.section[0]), value='<h1 class="gr-button-lg">{}</h1>'.format(item.section[1]))
components.append(create_setting_component(k))
items_displayed += 1
request_notifications = gr.Button(value='Request browser notifications', elem_id="request_notifications")
request_notifications.click(
......@@ -865,6 +874,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
_js='function(){}'
)
if column is not None:
column.__exit__()
settings_submit.click(
fn=run_settings,
inputs=components,
outputs=[result]
)
interfaces = [
(txt2img_interface, "txt2img", "txt2img"),
(img2img_interface, "img2img", "img2img"),
......
......@@ -11,7 +11,7 @@ from modules import images, processing, devices
from modules.processing import Processed, process_images
from modules.shared import opts, cmd_opts, state
# https://github.com/parlance-zz/g-diffuser-bot
def expand(x, dir, amount, power=0.75):
is_left = dir == 3
is_right = dir == 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment