commit
cce73d28b4
@ -1 +1 @@
|
|||||||
version = '2.1.855'
|
version = '2.1.856'
|
||||||
|
@ -243,10 +243,15 @@ default_advanced_checkbox = get_config_item_or_set_default(
|
|||||||
default_value=False,
|
default_value=False,
|
||||||
validator=lambda x: isinstance(x, bool)
|
validator=lambda x: isinstance(x, bool)
|
||||||
)
|
)
|
||||||
|
default_max_image_number = get_config_item_or_set_default(
|
||||||
|
key='default_max_image_number',
|
||||||
|
default_value=32,
|
||||||
|
validator=lambda x: isinstance(x, int) and x >= 1
|
||||||
|
)
|
||||||
default_image_number = get_config_item_or_set_default(
|
default_image_number = get_config_item_or_set_default(
|
||||||
key='default_image_number',
|
key='default_image_number',
|
||||||
default_value=2,
|
default_value=2,
|
||||||
validator=lambda x: isinstance(x, int) and 1 <= x <= 32
|
validator=lambda x: isinstance(x, int) and 1 <= x <= default_max_image_number
|
||||||
)
|
)
|
||||||
checkpoint_downloads = get_config_item_or_set_default(
|
checkpoint_downloads = get_config_item_or_set_default(
|
||||||
key='checkpoint_downloads',
|
key='checkpoint_downloads',
|
||||||
|
@ -3,7 +3,7 @@ import gradio as gr
|
|||||||
import modules.config
|
import modules.config
|
||||||
|
|
||||||
|
|
||||||
def load_parameter_button_click(raw_prompt_txt):
|
def load_parameter_button_click(raw_prompt_txt, is_generating):
|
||||||
loaded_parameter_dict = json.loads(raw_prompt_txt)
|
loaded_parameter_dict = json.loads(raw_prompt_txt)
|
||||||
assert isinstance(loaded_parameter_dict, dict)
|
assert isinstance(loaded_parameter_dict, dict)
|
||||||
|
|
||||||
@ -128,7 +128,11 @@ def load_parameter_button_click(raw_prompt_txt):
|
|||||||
results.append(gr.update())
|
results.append(gr.update())
|
||||||
results.append(gr.update())
|
results.append(gr.update())
|
||||||
|
|
||||||
results.append(gr.update(visible=True))
|
if is_generating:
|
||||||
|
results.append(gr.update())
|
||||||
|
else:
|
||||||
|
results.append(gr.update(visible=True))
|
||||||
|
|
||||||
results.append(gr.update(visible=False))
|
results.append(gr.update(visible=False))
|
||||||
|
|
||||||
for i in range(1, 6):
|
for i in range(1, 6):
|
||||||
|
@ -44,13 +44,28 @@ def log(img, dic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
js = (
|
js = (
|
||||||
"<script>"
|
"""<script>
|
||||||
"function to_clipboard(txt) { "
|
function to_clipboard(txt) {
|
||||||
"txt = decodeURIComponent(txt);"
|
txt = decodeURIComponent(txt);
|
||||||
"navigator.clipboard.writeText(txt);"
|
if (navigator.clipboard && navigator.permissions) {
|
||||||
"alert('Copied to Clipboard!\\nPaste to prompt area to load parameters.\\nCurrent clipboard content is:\\n\\n' + txt);"
|
navigator.clipboard.writeText(txt)
|
||||||
"}"
|
} else {
|
||||||
"</script>"
|
const textArea = document.createElement('textArea')
|
||||||
|
textArea.value = txt
|
||||||
|
textArea.style.width = 0
|
||||||
|
textArea.style.position = 'fixed'
|
||||||
|
textArea.style.left = '-999px'
|
||||||
|
textArea.style.top = '10px'
|
||||||
|
textArea.setAttribute('readonly', 'readonly')
|
||||||
|
document.body.appendChild(textArea)
|
||||||
|
|
||||||
|
textArea.select()
|
||||||
|
document.execCommand('copy')
|
||||||
|
document.body.removeChild(textArea)
|
||||||
|
}
|
||||||
|
alert('Copied to Clipboard!\\nPaste to prompt area to load parameters.\\nCurrent clipboard content is:\\n\\n' + txt);
|
||||||
|
}
|
||||||
|
</script>"""
|
||||||
)
|
)
|
||||||
|
|
||||||
begin_part = f"<html><head><title>Fooocus Log {date_string}</title>{css_styles}</head><body>{js}<p>Fooocus Log {date_string} (private)</p>\n<p>All images are clean, without any hidden data/meta, and safe to share with others.</p><!--fooocus-log-split-->\n\n"
|
begin_part = f"<html><head><title>Fooocus Log {date_string}</title>{css_styles}</head><body>{js}<p>Fooocus Log {date_string} (private)</p>\n<p>All images are clean, without any hidden data/meta, and safe to share with others.</p><!--fooocus-log-split-->\n\n"
|
||||||
|
21
webui.py
21
webui.py
@ -226,7 +226,7 @@ with shared.gradio_root:
|
|||||||
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
||||||
value=modules.config.default_aspect_ratio, info='width × height',
|
value=modules.config.default_aspect_ratio, info='width × height',
|
||||||
elem_classes='aspect_ratios')
|
elem_classes='aspect_ratios')
|
||||||
image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=modules.config.default_image_number)
|
image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number)
|
||||||
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
|
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
|
||||||
info='Describing what you do not want to see.', lines=2,
|
info='Describing what you do not want to see.', lines=2,
|
||||||
elem_id='negative_prompt',
|
elem_id='negative_prompt',
|
||||||
@ -513,7 +513,9 @@ with shared.gradio_root:
|
|||||||
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt]
|
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt]
|
||||||
ctrls += ip_ctrls
|
ctrls += ip_ctrls
|
||||||
|
|
||||||
def parse_meta(raw_prompt_txt):
|
state_is_generating = gr.State(False)
|
||||||
|
|
||||||
|
def parse_meta(raw_prompt_txt, is_generating):
|
||||||
loaded_json = None
|
loaded_json = None
|
||||||
try:
|
try:
|
||||||
if '{' in raw_prompt_txt:
|
if '{' in raw_prompt_txt:
|
||||||
@ -525,13 +527,16 @@ with shared.gradio_root:
|
|||||||
loaded_json = None
|
loaded_json = None
|
||||||
|
|
||||||
if loaded_json is None:
|
if loaded_json is None:
|
||||||
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
if is_generating:
|
||||||
|
return gr.update(), gr.update(), gr.update()
|
||||||
|
else:
|
||||||
|
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
||||||
|
|
||||||
return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True)
|
return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True)
|
||||||
|
|
||||||
prompt.input(parse_meta, inputs=prompt, outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
prompt.input(parse_meta, inputs=[prompt, state_is_generating], outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
||||||
|
|
||||||
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=prompt, outputs=[
|
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=[prompt, state_is_generating], outputs=[
|
||||||
advanced_checkbox,
|
advanced_checkbox,
|
||||||
image_number,
|
image_number,
|
||||||
prompt,
|
prompt,
|
||||||
@ -557,11 +562,13 @@ with shared.gradio_root:
|
|||||||
load_parameter_button
|
load_parameter_button
|
||||||
] + lora_ctrls, queue=False, show_progress=False)
|
] + lora_ctrls, queue=False, show_progress=False)
|
||||||
|
|
||||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
||||||
|
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
||||||
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
||||||
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
||||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
||||||
.then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \
|
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
||||||
|
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
||||||
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
||||||
|
|
||||||
for notification_file in ['notification.ogg', 'notification.mp3']:
|
for notification_file in ['notification.ogg', 'notification.mp3']:
|
||||||
|
Loading…
Reference in New Issue
Block a user