aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-20 20:10:01 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-20 20:10:01 +0300
commit19a75d38d79f4c754510c4745440f0c60d89cb78 (patch)
tree916f34f9b843e07ece088cf855a185cae20da7d8 /modules
parent06cd20610765aeb563700f377f1698a6e981b17d (diff)
added --use-textbox-seed option to make long seeds possible from web ui
Diffstat (limited to 'modules')
-rw-r--r--modules/processing.py8
-rw-r--r--modules/shared.py2
-rw-r--r--modules/ui.py2
3 files changed, 7 insertions, 5 deletions
diff --git a/modules/processing.py b/modules/processing.py
index c9ba6eb3..256e8aae 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -225,8 +225,8 @@ def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, see
def fix_seed(p):
- p.seed = int(random.randrange(4294967294)) if p.seed is None 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.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 == '' or p.subseed == -1 else p.subseed
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:
all_seeds = p.seed
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:
all_subseeds = p.subseed
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):
return create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration, position_in_batch)
diff --git a/modules/shared.py b/modules/shared.py
index ae4efbee..75fb56a3 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -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("--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("--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()
if cmd_opts.opt_split_attention:
diff --git a/modules/ui.py b/modules/ui.py
index 752bc97b..0d428b5b 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -257,7 +257,7 @@ def create_seed_inputs():
with gr.Row():
with gr.Box():
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)
random_seed = gr.Button(random_symbol, elem_id='random_seed')
reuse_seed = gr.Button(reuse_symbol, elem_id='reuse_seed')