mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
got rid of the cd and pwd commands, and just allow user to specify --outdir on the command
This commit is contained in:
parent
3b2569ebdd
commit
042a9043d1
@ -358,7 +358,7 @@ repository and associated paper for details and limitations.
|
|||||||
|
|
||||||
* It should no longer be possible for one image to overwrite another
|
* It should no longer be possible for one image to overwrite another
|
||||||
* You can use the "cd" and "pwd" commands at the dream> prompt to set and retrieve
|
* You can use the "cd" and "pwd" commands at the dream> prompt to set and retrieve
|
||||||
the path of the output directory.
|
the path of the output directory. (NOTE: Removed in v1.12)
|
||||||
|
|
||||||
* v1.04 (22 August 2022 - after the drop)
|
* v1.04 (22 August 2022 - after the drop)
|
||||||
* Updated README to reflect installation of the released weights.
|
* Updated README to reflect installation of the released weights.
|
||||||
|
@ -115,7 +115,7 @@ def main():
|
|||||||
|
|
||||||
if not infile:
|
if not infile:
|
||||||
print(
|
print(
|
||||||
"\n* Initialization done! Awaiting your command (-h for help, 'q' to quit, 'cd' to change output dir, 'pwd' to print output dir)..."
|
"\n* Initialization done! Awaiting your command (-h for help, 'q' to quit)"
|
||||||
)
|
)
|
||||||
|
|
||||||
log_path = os.path.join(opt.outdir, 'dream_log.txt')
|
log_path = os.path.join(opt.outdir, 'dream_log.txt')
|
||||||
@ -156,18 +156,6 @@ def main_loop(t2i, outdir, parser, log_path, infile):
|
|||||||
done = True
|
done = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if elements[0] == 'cd' and len(elements) > 1:
|
|
||||||
if os.path.exists(elements[1]):
|
|
||||||
print(f'setting image output directory to {elements[1]}')
|
|
||||||
outdir = elements[1]
|
|
||||||
else:
|
|
||||||
print(f'directory {elements[1]} does not exist')
|
|
||||||
continue
|
|
||||||
|
|
||||||
if elements[0] == 'pwd':
|
|
||||||
print(f'current output directory is {outdir}')
|
|
||||||
continue
|
|
||||||
|
|
||||||
if elements[0].startswith(
|
if elements[0].startswith(
|
||||||
'!dream'
|
'!dream'
|
||||||
): # in case a stored prompt still contains the !dream command
|
): # in case a stored prompt still contains the !dream command
|
||||||
@ -205,12 +193,18 @@ def main_loop(t2i, outdir, parser, log_path, infile):
|
|||||||
|
|
||||||
normalized_prompt = PromptFormatter(t2i, opt).normalize_prompt()
|
normalized_prompt = PromptFormatter(t2i, opt).normalize_prompt()
|
||||||
individual_images = not opt.grid
|
individual_images = not opt.grid
|
||||||
|
if opt.outdir:
|
||||||
|
if not os.path.exists(opt.outdir):
|
||||||
|
os.makedirs(opt.outdir)
|
||||||
|
current_outdir = opt.outdir
|
||||||
|
else:
|
||||||
|
current_outdir = outdir
|
||||||
|
|
||||||
# Here is where the images are actually generated!
|
# Here is where the images are actually generated!
|
||||||
try:
|
try:
|
||||||
file_writer = PngWriter(outdir, normalized_prompt, opt.batch_size)
|
file_writer = PngWriter(current_outdir, normalized_prompt, opt.batch_size)
|
||||||
callback = file_writer.write_image if individual_images else None
|
callback = file_writer.write_image if individual_images else None
|
||||||
image_list = t2i.prompt2image(image_callback=callback, **vars(opt))
|
image_list = t2i.prompt2image(image_callback=callback, **vars(opt))
|
||||||
results = (
|
results = (
|
||||||
file_writer.files_written if individual_images else image_list
|
file_writer.files_written if individual_images else image_list
|
||||||
)
|
)
|
||||||
@ -477,6 +471,13 @@ def create_cmd_parser():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-g', '--grid', action='store_true', help='generate a grid'
|
'-g', '--grid', action='store_true', help='generate a grid'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--outdir',
|
||||||
|
'-o',
|
||||||
|
type=str,
|
||||||
|
default=None,
|
||||||
|
help='directory in which to place generated images and a log of prompts and seeds (outputs/img-samples',
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-i',
|
'-i',
|
||||||
'--individual',
|
'--individual',
|
||||||
|
Loading…
Reference in New Issue
Block a user