mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-17 20:00:12 +08:00
[img2imgalt] Make sampler's override be optional
This commit is contained in:
parent
a4170875b0
commit
e548fc4aca
@ -121,10 +121,11 @@ class Script(scripts.Script):
|
|||||||
|
|
||||||
def ui(self, is_img2img):
|
def ui(self, is_img2img):
|
||||||
info = gr.Markdown('''
|
info = gr.Markdown('''
|
||||||
* `Sampling method` is overriden as Euler, as this script is built on it.
|
|
||||||
* `CFG Scale` should be 2 or lower.
|
* `CFG Scale` should be 2 or lower.
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
override_sampler = gr.Checkbox(label="Override `Sampling method` to Euler?(this method is built for it)", value=True)
|
||||||
|
|
||||||
override_prompt = gr.Checkbox(label="Override `prompt` to the same value as `original prompt`?(and `negative prompt`)", value=True)
|
override_prompt = gr.Checkbox(label="Override `prompt` to the same value as `original prompt`?(and `negative prompt`)", value=True)
|
||||||
original_prompt = gr.Textbox(label="Original prompt", lines=1)
|
original_prompt = gr.Textbox(label="Original prompt", lines=1)
|
||||||
original_negative_prompt = gr.Textbox(label="Original negative prompt", lines=1)
|
original_negative_prompt = gr.Textbox(label="Original negative prompt", lines=1)
|
||||||
@ -140,17 +141,17 @@ class Script(scripts.Script):
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
info,
|
info,
|
||||||
|
override_sampler,
|
||||||
override_prompt, original_prompt, original_negative_prompt,
|
override_prompt, original_prompt, original_negative_prompt,
|
||||||
override_steps, st,
|
override_steps, st,
|
||||||
override_strength,
|
override_strength,
|
||||||
cfg, randomness, sigma_adjustment,
|
cfg, randomness, sigma_adjustment,
|
||||||
]
|
]
|
||||||
|
|
||||||
def run(self, p, _, override_prompt, original_prompt, original_negative_prompt, override_steps, st, override_strength, cfg, randomness, sigma_adjustment):
|
def run(self, p, _, override_sampler, override_prompt, original_prompt, original_negative_prompt, override_steps, st, override_strength, cfg, randomness, sigma_adjustment):
|
||||||
# MUST Override
|
# Override
|
||||||
|
if override_sampler:
|
||||||
p.sampler_index = [sampler.name for sampler in sd_samplers.samplers].index("Euler")
|
p.sampler_index = [sampler.name for sampler in sd_samplers.samplers].index("Euler")
|
||||||
|
|
||||||
# OPTIONAL Override
|
|
||||||
if override_prompt:
|
if override_prompt:
|
||||||
p.prompt = original_prompt
|
p.prompt = original_prompt
|
||||||
p.negative_prompt = original_negative_prompt
|
p.negative_prompt = original_negative_prompt
|
||||||
|
Loading…
Reference in New Issue
Block a user