268 store_offset = offset 269 if lock_indicator: 270 offset = offset_seed 271 elif random_indicator: 272 offset = random.randint(0, 1000000) 273 elif increment_indicator: 274 offset = offset_seed + 1 275 elif decrement_indicator:
274 offset = offset_seed + 1 275 elif decrement_indicator: 276 offset = offset_seed - 1 277 else: 278 offset = random.randint(0, 1000000) 279 selected_lines = [] 280 with open(file_path, 'r', encoding='utf-8') as file: 281 file_lines = file.readlines()
319 # select a random word from the | separated list 320 random.seed(seed) 321 wc_re = re.compile(r'{([^}]+)}') 322 def repl(m): 323 return random.choice(m.group(1).split('|')) 324 for m in wc_re.finditer(text): 325 text = text.replace(m.group(0), repl(m)) 326 return text
504 505 # Iterate through matches 506 for match in matches: 507 lower_bound, upper_bound = map(float, match.groups()) 508 random_value = random.uniform(lower_bound, upper_bound) 509 random_value = round(random_value, 4) 510 511 # Append text up to the match and the generated number
2081 positive_prompt_ = find_and_replace_wildcards(positive_prompt, seed, True) 2082 negative_prompt_ = find_and_replace_wildcards(negative_prompt, seed, True) 2083 add_metadata_to_dict(prompt_with_style, positive_prompt=positive_prompt_, negative_prompt=negative_prompt_) 2084 if len(positive_prompt_) != len(positive_prompt) or len(negative_prompt_) != len(negative_prompt): 2085 seed += random.randint(0, 1000000) 2086 positive_prompt = positive_prompt_ 2087 negative_prompt = negative_prompt_ 2088 # extract and load loras
2343 text = process_random_syntax(text, seed) 2344 # process wildcards 2345 text_ = find_and_replace_wildcards(text, seed, True) 2346 if len(text_) != len(text): 2347 seed = random.randint(0, 1000000) 2348 else: 2349 seed = 1 2350 # extract and load loras
3779 # Split the string by '+' to identify individual text components 3780 components = output_text.split(" + ") 3781 3782 # Generate the final string for each output 3783 final_output = delimiter.join(eval(comp, {}, text_dict) for comp in components) 3784 3785 outputs.append(final_output) 3786
3837 # Split the string by '+' to identify individual text components 3838 components = output_text.split(" + ") 3839 3840 # Generate the final string for each output 3841 final_output = delimiter.join(eval(comp, {}, text_dict) for comp in components) 3842 3843 outputs.append(final_output) 3844
3977 # wildcard sytax is {like|this} 3978 # select a random word from the | separated list 3979 wc_re = re.compile(r'{([^}]+)}') 3980 def repl(m): 3981 return random.choice(m.group(1).split('|')) 3982 for m in wc_re.finditer(text): 3983 text = text.replace(m.group(0), repl(m)) 3984 prompt.get(str(unique_id))['inputs']['text'] = preserve_text
4347 'unusual example of', 'a classic', 'an underrated', 'an innovative','a historical', 'a modern', 'a contemporary', 4348 'a futuristic', 'a traditional', 'an eco-friendly', 'a controversial', 'a political', 'a religious', 4349 'a spiritual', 'a philosophical', 'a scientific'] 4350 random.seed(seed) 4351 prompt = f'{random.choice(spice)} {prompt}' 4352 request = { 4353 'user_input': prompt, 4354 'max_new_tokens': 250,
4381 # wildcard sytax is {like|this} 4382 # select a random word from the | separated list 4383 wc_re = re.compile(r'{([^}]+)}') 4384 def repl(m): 4385 return random.choice(m.group(1).split('|')) 4386 for m in wc_re.finditer(input_prompt): 4387 input_prompt = input_prompt.replace(m.group(0), repl(m)) 4388 result = self.api_request(input_prompt, seed, mode, custom_history)
4412 # wildcard sytax is {like|this} 4413 # select a random word from the | separated list 4414 wc_re = re.compile(r'{([^}]+)}') 4415 def repl(m): 4416 return random.choice(m.group(1).split('|')) 4417 for m in wc_re.finditer(input_prompt): 4418 input_prompt = input_prompt.replace(m.group(0), repl(m)) 4419 # process wildcards
4593 'unusual example of', 'a classic', 'an underrated', 'an innovative','a historical', 'a modern', 'a contemporary', 4594 'a futuristic', 'a traditional', 'an eco-friendly', 'a controversial', 'a political', 'a religious', 4595 'a spiritual', 'a philosophical', 'a scientific'] 4596 random.seed(seed) 4597 prompt = f'{random.choice(spice)} {prompt}' 4598 """ 4599 example curl request to LM Studio 4600 curl http://localhost:1234/v1/chat/completions \
4646 # wildcard sytax is {like|this} 4647 # select a random word from the | separated list 4648 wc_re = re.compile(r'{([^}]+)}') 4649 def repl(m): 4650 return random.choice(m.group(1).split('|')) 4651 for m in wc_re.finditer(input_prompt): 4652 input_prompt = input_prompt.replace(m.group(0), repl(m)) 4653 result = self.api_request(input_prompt, server_address, server_port, seed, mode, custom_history)
4671 def process(self, a, b, formula): 4672 # eval formula 4673 formula = formula.replace('a', str(a)) 4674 formula = formula.replace('b', str(b)) 4675 result = eval(formula) 4676 return (result, int(result), str(result)) 4677 4678 class ImageOverlay: