added --use-textbox-seed option to make long seeds possible from web ui
This commit is contained in:
parent
06cd206107
commit
19a75d38d7
|
@ -225,8 +225,8 @@ def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, see
|
||||||
|
|
||||||
|
|
||||||
def fix_seed(p):
|
def fix_seed(p):
|
||||||
p.seed = int(random.randrange(4294967294)) if p.seed is None or p.seed == -1 else p.seed
|
p.seed = int(random.randrange(4294967294)) if p.seed is None or p.seed == '' or p.seed == -1 else p.seed
|
||||||
p.subseed = int(random.randrange(4294967294)) if p.subseed is None or p.subseed == -1 else p.subseed
|
p.subseed = int(random.randrange(4294967294)) if p.subseed is None or p.subseed == '' or p.subseed == -1 else p.subseed
|
||||||
|
|
||||||
|
|
||||||
def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration=0, position_in_batch=0):
|
def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration=0, position_in_batch=0):
|
||||||
|
@ -286,12 +286,12 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
|
||||||
if type(p.seed) == list:
|
if type(p.seed) == list:
|
||||||
all_seeds = p.seed
|
all_seeds = p.seed
|
||||||
else:
|
else:
|
||||||
all_seeds = [int(p.seed + (x if p.subseed_strength == 0 else 0)) for x in range(len(all_prompts))]
|
all_seeds = [int(p.seed) + (x if p.subseed_strength == 0 else 0) for x in range(len(all_prompts))]
|
||||||
|
|
||||||
if type(p.subseed) == list:
|
if type(p.subseed) == list:
|
||||||
all_subseeds = p.subseed
|
all_subseeds = p.subseed
|
||||||
else:
|
else:
|
||||||
all_subseeds = [int(p.subseed + x) for x in range(len(all_prompts))]
|
all_subseeds = [int(p.subseed) + x for x in range(len(all_prompts))]
|
||||||
|
|
||||||
def infotext(iteration=0, position_in_batch=0):
|
def infotext(iteration=0, position_in_batch=0):
|
||||||
return create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration, position_in_batch)
|
return create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration, position_in_batch)
|
||||||
|
|
|
@ -49,6 +49,8 @@ parser.add_argument("--gradio-auth", type=str, help='set gradio authentication l
|
||||||
parser.add_argument("--opt-channelslast", action='store_true', help="change memory type for stable diffusion to channels last")
|
parser.add_argument("--opt-channelslast", action='store_true', help="change memory type for stable diffusion to channels last")
|
||||||
parser.add_argument("--styles-file", type=str, help="filename to use for styles", default=os.path.join(script_path, 'styles.csv'))
|
parser.add_argument("--styles-file", type=str, help="filename to use for styles", default=os.path.join(script_path, 'styles.csv'))
|
||||||
parser.add_argument("--autolaunch", action='store_true', help="open the webui URL in the system's default browser upon launch", default=False)
|
parser.add_argument("--autolaunch", action='store_true', help="open the webui URL in the system's default browser upon launch", default=False)
|
||||||
|
parser.add_argument("--use-textbox-seed", action='store_true', help="use textbox for seeds in UI (no up/down, but possible to input long seeds)", default=False)
|
||||||
|
|
||||||
cmd_opts = parser.parse_args()
|
cmd_opts = parser.parse_args()
|
||||||
|
|
||||||
if cmd_opts.opt_split_attention:
|
if cmd_opts.opt_split_attention:
|
||||||
|
|
|
@ -257,7 +257,7 @@ def create_seed_inputs():
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Box():
|
with gr.Box():
|
||||||
with gr.Row(elem_id='seed_row'):
|
with gr.Row(elem_id='seed_row'):
|
||||||
seed = gr.Number(label='Seed', value=-1)
|
seed = (gr.Textbox if cmd_opts.use_textbox_seed else gr.Number)(label='Seed', value=-1)
|
||||||
seed.style(container=False)
|
seed.style(container=False)
|
||||||
random_seed = gr.Button(random_symbol, elem_id='random_seed')
|
random_seed = gr.Button(random_symbol, elem_id='random_seed')
|
||||||
reuse_seed = gr.Button(reuse_symbol, elem_id='reuse_seed')
|
reuse_seed = gr.Button(reuse_symbol, elem_id='reuse_seed')
|
||||||
|
|
Loading…
Reference in New Issue