prompts module¶
Contains a function to load prompts from available files.
- lib.prompts.load_prompts(dir_path)¶
Looks up a directory path, takes a full path for it, lists for directory contents and loads all available prompts.
Example
>>> from lib.prompts import load_prompts >>> prompts = load_prompts('./prompts') >>> prompts[-3:] [ '.imagine α-pinene pool ; vray ; PBR ; HDR ; closeup ; DSLR ; hyperrealistic', '.imagine omicron ; vray ; hdr illumination ; contest winner', '.imagine the night ; vray ; isonoise ; contest winner ; highly sought art' ]
- Parameters
dir_path (str) – a path to the prompt directory
- Returns
a list of strings containing CLIP prompts
- lib.prompts.prompt_split(prompt, maxsplit=0)¶
Split to unique prompts.
Examples
>>> prompt_split('.imagine the Fresnel lens ; in fine detail ; rendered in charcoal | realistic', 1) ['.imagine the Fresnel lens', 'in fine detail ; rendered in charcoal | realistic']
>>> prompt_split('in fine detail ; rendered in charcoal | realistic') ['in fine detail', 'rendered in charcoal', 'realistic']
- Parameters
prompt (str) – a prompt to split
maxsplit (int) – a maximum number of splits
- Returns
a list of strings containing prompt elements