Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bc3332d86 | |||
| f8395750f4 |
@@ -314,7 +314,6 @@ options_templates.update(options_section(('ui_gallery', "Gallery", "ui"), {
|
||||
"sd_webui_modal_lightbox_toolbar_opacity": OptionInfo(0.9, "Full page image viewer: tool bar opacity", gr.Slider, {"minimum": 0.0, "maximum": 1, "step": 0.01}, onchange=shared.reload_gradio_theme).info('for mouse only').needs_reload_ui(),
|
||||
"gallery_height": OptionInfo("", "Gallery height", gr.Textbox).info("can be any valid CSS value, for example 768px or 20em").needs_reload_ui(),
|
||||
"open_dir_button_choice": OptionInfo("Subdirectory", "What directory the [📂] button opens", gr.Radio, {"choices": ["Output Root", "Subdirectory", "Subdirectory (even temp dir)"]}),
|
||||
"hires_button_gallery_inset": OptionInfo(False, "Insert [✨] hires button results to gallery").info("when False the original first pass image is replaced by the results"),
|
||||
}))
|
||||
|
||||
options_templates.update(options_section(('ui_alternatives', "UI alternatives", "ui"), {
|
||||
|
||||
+3
-7
@@ -87,19 +87,15 @@ def txt2img_upscale(id_task: str, request: gr.Request, gallery, gallery_index, g
|
||||
new_gallery = []
|
||||
for i, image in enumerate(gallery):
|
||||
if i == gallery_index:
|
||||
if shared.opts.hires_button_gallery_inset:
|
||||
fake_image = Image.new(mode="RGB", size=(1, 1))
|
||||
fake_image.already_saved_as = image["name"].rsplit('?', 1)[0]
|
||||
new_gallery.append(fake_image)
|
||||
geninfo["infotexts"][gallery_index+1: gallery_index+1] = processed.infotexts
|
||||
else:
|
||||
geninfo["infotexts"][gallery_index: gallery_index+1] = processed.infotexts
|
||||
geninfo["infotexts"][gallery_index: gallery_index+1] = processed.infotexts
|
||||
new_gallery.extend(processed.images)
|
||||
else:
|
||||
fake_image = Image.new(mode="RGB", size=(1, 1))
|
||||
fake_image.already_saved_as = image["name"].rsplit('?', 1)[0]
|
||||
new_gallery.append(fake_image)
|
||||
|
||||
geninfo["infotexts"][gallery_index] = processed.info
|
||||
|
||||
return new_gallery, json.dumps(geninfo), plaintext_to_html(processed.info), plaintext_to_html(processed.comments, classname="comments")
|
||||
|
||||
|
||||
|
||||
@@ -11,25 +11,30 @@ from modules.shared import state
|
||||
|
||||
|
||||
def process_model_tag(tag):
|
||||
"""\"mode-name\""""
|
||||
info = sd_models.get_closet_checkpoint_match(tag)
|
||||
assert info is not None, f'Unknown checkpoint: {tag}'
|
||||
return info.name
|
||||
|
||||
|
||||
def process_string_tag(tag):
|
||||
"""\"str\""""
|
||||
return tag
|
||||
|
||||
|
||||
def process_int_tag(tag):
|
||||
"""int-number"""
|
||||
return int(tag)
|
||||
|
||||
|
||||
def process_float_tag(tag):
|
||||
"""float-number"""
|
||||
return float(tag)
|
||||
|
||||
|
||||
def process_boolean_tag(tag):
|
||||
return True if (tag == "true") else False
|
||||
"""true|false"""
|
||||
return True if (tag.lower() == "true") else False
|
||||
|
||||
|
||||
prompt_tags = {
|
||||
@@ -60,6 +65,27 @@ prompt_tags = {
|
||||
}
|
||||
|
||||
|
||||
def doc_md():
|
||||
md = '<details><summary>Usage Syntax</summary><p>\n\n'
|
||||
for key, func in prompt_tags.items():
|
||||
md += f'`--{key}` `{func.__doc__}`\n'
|
||||
|
||||
md += '''
|
||||
<details><summary>Example</summary><p>
|
||||
|
||||
```shell
|
||||
--prompt "photo of sunset"
|
||||
--prompt "photo of sunset" --negative_prompt "orange, pink, red, sea, water, lake" --width 1024 --height 768 --sampler_name "DPM++ 2M Karras" --steps 10 --batch_size 2 --cfg_scale 3 --seed 9
|
||||
--prompt "photo of winter mountains" --steps 7 --sampler_name "DDIM"
|
||||
--prompt "photo of winter mountains" --width 1024
|
||||
```
|
||||
</p></details>
|
||||
'''
|
||||
|
||||
md += '</p></details>'
|
||||
return md
|
||||
|
||||
|
||||
def cmdargs(line):
|
||||
args = shlex.split(line)
|
||||
pos = 0
|
||||
@@ -84,7 +110,6 @@ def cmdargs(line):
|
||||
res[tag] = prompt
|
||||
continue
|
||||
|
||||
|
||||
func = prompt_tags.get(tag, None)
|
||||
assert func, f'unknown commandline option: {arg}'
|
||||
|
||||
@@ -125,6 +150,9 @@ class Script(scripts.Script):
|
||||
# We don't shrink back to 1, because that causes the control to ignore [enter], and it may
|
||||
# be unclear to the user that shift-enter is needed.
|
||||
prompt_txt.change(lambda tb: gr.update(lines=7) if ("\n" in tb) else gr.update(lines=2), inputs=[prompt_txt], outputs=[prompt_txt], show_progress=False)
|
||||
|
||||
gr.Markdown(doc_md())
|
||||
|
||||
return [checkbox_iterate, checkbox_iterate_batch, prompt_position, prompt_txt]
|
||||
|
||||
def run(self, p, checkbox_iterate, checkbox_iterate_batch, prompt_position, prompt_txt: str):
|
||||
|
||||
Reference in New Issue
Block a user