mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
add an option to show negative prompt
This commit is contained in:
parent
41434ba3cd
commit
003b60b94e
@ -11,7 +11,7 @@ from modules.ui import plaintext_to_html
|
|||||||
import modules.images as images
|
import modules.images as images
|
||||||
import modules.scripts
|
import modules.scripts
|
||||||
|
|
||||||
def img2img(prompt: str, init_img, init_img_with_mask, steps: int, sampler_index: int, mask_blur: int, inpainting_fill: int, restore_faces: bool, tiling: bool, mode: int, n_iter: int, batch_size: int, cfg_scale: float, denoising_strength: float, denoising_strength_change_factor: float, seed: int, height: int, width: int, resize_mode: int, upscaler_index: str, upscale_overlap: int, inpaint_full_res: bool, inpainting_mask_invert: int, *args):
|
def img2img(prompt: str, negative_prompt: str, init_img, init_img_with_mask, steps: int, sampler_index: int, mask_blur: int, inpainting_fill: int, restore_faces: bool, tiling: bool, mode: int, n_iter: int, batch_size: int, cfg_scale: float, denoising_strength: float, denoising_strength_change_factor: float, seed: int, height: int, width: int, resize_mode: int, upscaler_index: str, upscale_overlap: int, inpaint_full_res: bool, inpainting_mask_invert: int, *args):
|
||||||
is_inpaint = mode == 1
|
is_inpaint = mode == 1
|
||||||
is_loopback = mode == 2
|
is_loopback = mode == 2
|
||||||
is_upscale = mode == 3
|
is_upscale = mode == 3
|
||||||
@ -32,6 +32,7 @@ def img2img(prompt: str, init_img, init_img_with_mask, steps: int, sampler_index
|
|||||||
outpath_samples=opts.outdir_samples or opts.outdir_img2img_samples,
|
outpath_samples=opts.outdir_samples or opts.outdir_img2img_samples,
|
||||||
outpath_grids=opts.outdir_grids or opts.outdir_img2img_grids,
|
outpath_grids=opts.outdir_grids or opts.outdir_img2img_grids,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
|
negative_prompt=negative_prompt,
|
||||||
seed=seed,
|
seed=seed,
|
||||||
sampler_index=sampler_index,
|
sampler_index=sampler_index,
|
||||||
batch_size=batch_size,
|
batch_size=batch_size,
|
||||||
|
@ -37,6 +37,8 @@ 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("--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("--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("--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)
|
||||||
|
|
||||||
cmd_opts = parser.parse_args()
|
cmd_opts = parser.parse_args()
|
||||||
|
|
||||||
if torch.has_cuda:
|
if torch.has_cuda:
|
||||||
@ -76,6 +78,7 @@ artist_db = modules.artists.ArtistsDatabase(os.path.join(script_path, 'artists.c
|
|||||||
|
|
||||||
face_restorers = []
|
face_restorers = []
|
||||||
|
|
||||||
|
|
||||||
def find_any_font():
|
def find_any_font():
|
||||||
fonts = ['/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf']
|
fonts = ['/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf']
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
|
|||||||
with gr.Blocks(analytics_enabled=False) as txt2img_interface:
|
with gr.Blocks(analytics_enabled=False) as txt2img_interface:
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
prompt = gr.Textbox(label="Prompt", elem_id="txt2img_prompt", show_label=False, placeholder="Prompt", lines=1)
|
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=False)
|
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)
|
||||||
roll = gr.Button('Roll', elem_id="txt2img_roll", visible=len(shared.artist_db.artists) > 0)
|
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')
|
submit = gr.Button('Generate', elem_id="txt2img_generate", variant='primary')
|
||||||
check_progress = gr.Button('Check progress', elem_id="check_progress", visible=False)
|
check_progress = gr.Button('Check progress', elem_id="check_progress", visible=False)
|
||||||
@ -314,6 +314,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
|
|||||||
with gr.Blocks(analytics_enabled=False) as img2img_interface:
|
with gr.Blocks(analytics_enabled=False) as img2img_interface:
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
prompt = gr.Textbox(label="Prompt", elem_id="img2img_prompt", show_label=False, placeholder="Prompt", lines=1)
|
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)
|
||||||
submit = gr.Button('Generate', elem_id="img2img_generate", variant='primary')
|
submit = gr.Button('Generate', elem_id="img2img_generate", variant='primary')
|
||||||
check_progress = gr.Button('Check progress', elem_id="check_progress", visible=False)
|
check_progress = gr.Button('Check progress', elem_id="check_progress", visible=False)
|
||||||
|
|
||||||
@ -423,6 +424,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
|
|||||||
_js="submit",
|
_js="submit",
|
||||||
inputs=[
|
inputs=[
|
||||||
prompt,
|
prompt,
|
||||||
|
negative_prompt,
|
||||||
init_img,
|
init_img,
|
||||||
init_img_with_mask,
|
init_img_with_mask,
|
||||||
steps,
|
steps,
|
||||||
|
@ -14,7 +14,7 @@ button{
|
|||||||
align-self: stretch !important;
|
align-self: stretch !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#img2img_prompt, #txt2img_prompt{
|
#img2img_prompt, #txt2img_prompt, #img2img_negative_prompt, #txt2img_negative_prompt{
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user