mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 02:45:05 +08:00
Add output folder icons
Adds icons on the first 3 tabs to directly open the corresponding images output directory
This commit is contained in:
parent
4127f4aff8
commit
f8acbb8f88
@ -15,6 +15,7 @@ titles = {
|
||||
"\u267b\ufe0f": "Reuse seed from last generation, mostly useful if it was randomed",
|
||||
"\u{1f3a8}": "Add a random artist to the prompt.",
|
||||
"\u2199\ufe0f": "Read generation parameters from prompt into user interface.",
|
||||
"\uD83D\uDCC2": "Open images output directory",
|
||||
|
||||
"Inpaint a part of image": "Draw a mask over an image, and the script will regenerate the masked area with content according to prompt",
|
||||
"SD upscale": "Upscale image normally, split result into tiles, improve each tile using img2img, merge whole image back",
|
||||
|
@ -61,7 +61,7 @@ random_symbol = '\U0001f3b2\ufe0f' # 🎲️
|
||||
reuse_symbol = '\u267b\ufe0f' # ♻️
|
||||
art_symbol = '\U0001f3a8' # 🎨
|
||||
paste_symbol = '\u2199\ufe0f' # ↙
|
||||
|
||||
folder_symbol = '\uD83D\uDCC2'
|
||||
|
||||
def plaintext_to_html(text):
|
||||
text = "<p>" + "<br>\n".join([f"{html.escape(x)}" for x in text.split('\n')]) + "</p>"
|
||||
@ -461,6 +461,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
|
||||
send_to_img2img = gr.Button('Send to img2img')
|
||||
send_to_inpaint = gr.Button('Send to inpaint')
|
||||
send_to_extras = gr.Button('Send to extras')
|
||||
open_txt2img_folder = gr.Button(folder_symbol, elem_id="open_folder")
|
||||
|
||||
with gr.Group():
|
||||
html_info = gr.HTML()
|
||||
@ -637,6 +638,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
|
||||
img2img_send_to_img2img = gr.Button('Send to img2img')
|
||||
img2img_send_to_inpaint = gr.Button('Send to inpaint')
|
||||
img2img_send_to_extras = gr.Button('Send to extras')
|
||||
open_img2img_folder = gr.Button(folder_symbol, elem_id="open_folder")
|
||||
|
||||
with gr.Group():
|
||||
html_info = gr.HTML()
|
||||
@ -809,6 +811,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
|
||||
html_info = gr.HTML()
|
||||
extras_send_to_img2img = gr.Button('Send to img2img')
|
||||
extras_send_to_inpaint = gr.Button('Send to inpaint')
|
||||
open_extras_folder = gr.Button('Open output directory')
|
||||
|
||||
submit.click(
|
||||
fn=run_extras,
|
||||
@ -907,6 +910,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
|
||||
components = []
|
||||
component_dict = {}
|
||||
|
||||
def open_folder(f):
|
||||
os.startfile(os.path.normpath(f))
|
||||
|
||||
def run_settings(*args):
|
||||
changed = 0
|
||||
|
||||
@ -1068,6 +1074,24 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
|
||||
outputs=[extras_image],
|
||||
)
|
||||
|
||||
open_txt2img_folder.click(
|
||||
fn=lambda: open_folder(opts.outdir_samples or opts.outdir_txt2img_samples),
|
||||
inputs=[],
|
||||
outputs=[],
|
||||
)
|
||||
|
||||
open_img2img_folder.click(
|
||||
fn=lambda: open_folder(opts.outdir_samples or opts.outdir_img2img_samples),
|
||||
inputs=[],
|
||||
outputs=[],
|
||||
)
|
||||
|
||||
open_extras_folder.click(
|
||||
fn=lambda: open_folder(opts.outdir_samples or opts.outdir_extras_samples),
|
||||
inputs=[],
|
||||
outputs=[],
|
||||
)
|
||||
|
||||
img2img_send_to_extras.click(
|
||||
fn=lambda x: image_from_url_text(x),
|
||||
_js="extract_image_from_gallery_extras",
|
||||
|
@ -1,5 +1,11 @@
|
||||
.output-html p {margin: 0 0.5em;}
|
||||
|
||||
.row > *,
|
||||
.row > .gr-form > * {
|
||||
min-width: min(120px, 100%);
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
|
||||
.performance {
|
||||
font-size: 0.85em;
|
||||
color: #444;
|
||||
@ -43,7 +49,7 @@
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#random_seed, #random_subseed, #reuse_seed, #reuse_subseed{
|
||||
#random_seed, #random_subseed, #reuse_seed, #reuse_subseed, #open_folder{
|
||||
min-width: auto;
|
||||
flex-grow: 0;
|
||||
padding-left: 0.25em;
|
||||
|
Loading…
Reference in New Issue
Block a user