aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-10 15:41:29 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-10 15:41:29 +0300
commit43bdbe934a3fbd4a1d2be18bcf0e38f0f088d10c (patch)
treedc8c3b5899d826b47becbbff4801d56a92546b65
parent13eec4f3d4081fdc43883c5ef02e471a2b6c7212 (diff)
enabled negative prompt by default
fixed broken empty directory when prompt does not start withl etter
-rw-r--r--README.md1
-rw-r--r--modules/images.py2
-rw-r--r--modules/shared.py2
-rw-r--r--modules/ui.py4
-rw-r--r--style.css3
5 files changed, 8 insertions, 4 deletions
diff --git a/README.md b/README.md
index 37754b2e..edd5e742 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,7 @@ A browser interface based on Gradio library for Stable Diffusion.
- Random artist button
- Tiling support: UI checkbox to create images that can be tiled like textures
- Progress bar and live image generation preview
+- Negative prompt
- Styles
- Variations
- Seed resizing
diff --git a/modules/images.py b/modules/images.py
index d8e74533..fc5d370f 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -263,7 +263,7 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
save_to_dirs = (is_a_grid and opts.grid_save_to_dirs) or (not is_a_grid and opts.save_to_dirs)
if save_to_dirs and not no_prompt:
- words = re_nonletters.split(prompt or "")
+ words = [x for x in re_nonletters.split(prompt or "") if len(x)>0]
if len(words[0]) == 0:
words = ["empty"]
diff --git a/modules/shared.py b/modules/shared.py
index 50c09187..614fd5a3 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -37,7 +37,7 @@ parser.add_argument("--esrgan-models-path", type=str, help="path to directory wi
parser.add_argument("--opt-split-attention", action='store_true', help="enable optimization that reduce vram usage by a lot for about 10%% decrease in performance")
parser.add_argument("--listen", action='store_true', help="launch gradio with 0.0.0.0 as server name, allowing to respond to network requests")
parser.add_argument("--port", type=int, help="launch gradio with given server port, you need root/admin rights for ports < 1024, defaults to 7860 if available", default=None)
-parser.add_argument("--show-negative-prompt", action='store_true', help="enable the field that lets you input negative prompt", default=False)
+parser.add_argument("--show-negative-prompt", action='store_true', help="does not do anything", default=False)
parser.add_argument("--ui-config-file", type=str, help="filename to use for ui configuration", default=os.path.join(script_path, 'ui-config.json'))
cmd_opts = parser.parse_args()
diff --git a/modules/ui.py b/modules/ui.py
index 6898f8a8..d16231f1 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -246,7 +246,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
with gr.Blocks(analytics_enabled=False) as txt2img_interface:
with gr.Row():
txt2img_prompt = gr.Textbox(label="Prompt", elem_id="txt2img_prompt", show_label=False, placeholder="Prompt", lines=1)
- negative_prompt = gr.Textbox(label="Negative prompt", elem_id="txt2img_negative_prompt", show_label=False, placeholder="Negative prompt", lines=1, visible=cmd_opts.show_negative_prompt)
+ negative_prompt = gr.Textbox(label="Negative prompt", elem_id="txt2img_negative_prompt", show_label=False, placeholder="Negative prompt", lines=1)
txt2img_prompt_style = gr.Dropdown(label="Style", show_label=False, elem_id="style_index", choices=[k for k, v in shared.prompt_styles.items()], value=next(iter(shared.prompt_styles.keys())), visible=len(shared.prompt_styles) > 1)
roll = gr.Button('Roll', elem_id="txt2img_roll", visible=len(shared.artist_db.artists) > 0)
submit = gr.Button('Generate', elem_id="txt2img_generate", variant='primary')
@@ -367,7 +367,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
with gr.Blocks(analytics_enabled=False) as img2img_interface:
with gr.Row():
img2img_prompt = gr.Textbox(label="Prompt", elem_id="img2img_prompt", show_label=False, placeholder="Prompt", lines=1)
- negative_prompt = gr.Textbox(label="Negative prompt", elem_id="img2img_negative_prompt", show_label=False, placeholder="Negative prompt", lines=1, visible=cmd_opts.show_negative_prompt)
+ negative_prompt = gr.Textbox(label="Negative prompt", elem_id="img2img_negative_prompt", show_label=False, placeholder="Negative prompt", lines=1)
img2img_prompt_style = gr.Dropdown(label="Style", show_label=False, elem_id="style_index", choices=[k for k, v in shared.prompt_styles.items()], value=next(iter(shared.prompt_styles.keys())), visible=len(shared.prompt_styles) > 1)
submit = gr.Button('Generate', elem_id="img2img_generate", variant='primary')
check_progress = gr.Button('Check progress', elem_id="check_progress", visible=False)
diff --git a/style.css b/style.css
index a3646c16..d94b79d2 100644
--- a/style.css
+++ b/style.css
@@ -124,6 +124,9 @@ input[type="range"]{
margin-bottom: 0.5em;
}
+#txt2img_negative_prompt, #img2img_negative_prompt{
+ flex: 0.3;
+}
.progressDiv{
width: 100%;