Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4861dccf7c | |||
| eed3b43252 |
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import re
|
||||
import gradio as gr
|
||||
|
||||
from modules import localization, shared, scripts, util
|
||||
@@ -49,12 +50,21 @@ def css_html():
|
||||
return head
|
||||
|
||||
|
||||
re_preconnect = re.compile(rb'<link\s+rel="preconnect"\s+href="([^"]+)"(?:\s+[^>]*)?/?>')
|
||||
|
||||
|
||||
def reload_javascript():
|
||||
js = javascript_html()
|
||||
css = css_html()
|
||||
|
||||
def template_response(*args, **kwargs):
|
||||
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
|
||||
|
||||
# remove preconnects
|
||||
res.body = re_preconnect.sub(b'', res.body)
|
||||
# replace iframeResizer with local version
|
||||
res.body = res.body.replace(b'src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.6/iframeResizer.contentWindow.min.js"', b'src="webui-assets/js/iframe-resizer/4.3.6/iframeResizer.contentWindow.min.js"')
|
||||
|
||||
res.body = res.body.replace(b'</head>', f'{js}<meta name="referrer" content="no-referrer"/></head>'.encode("utf8"))
|
||||
res.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))
|
||||
res.init_headers()
|
||||
|
||||
Reference in New Issue
Block a user