#!/usr/bin/env python3
-from sys import argv, exit as sys_exit
+from sys import argv, exit as sys_exit, stdin
from os.path import dirname, basename, splitext, join as path_join, exists
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from random import randint
parser.add_argument('-S', '--scheduler', default=DEFAULT_SCHEDULER,
help='name of denoising scheduler; --list-schedulers '
'prints available choices for chosen model')
- parser.add_argument('-D', '--defaults_from_params_string',
- help='string to parse for image generation options '
+ parser.add_argument('-D', '--defaults_from_stdin', action='store_true',
+ help='parse stdin for image generation options '
'(e.g. from image file EXIF comment)')
parser.add_argument('-P', '--model_path_prefix',
help='optional directory path prefix to MODEL for '
help='list options for -S available with chosen model')
parsed_args = parser.parse_args()
parser.set_defaults(model_path_prefix='')
- if parsed_args.defaults_from_params_string:
- first_split = parsed_args.\
- defaults_from_params_string.split('; PROMPT: ', maxsplit=1)
+ if parsed_args.defaults_from_stdin:
+ defaults_string = stdin.read()
+ first_split = defaults_string.split('; PROMPT: ', maxsplit=1)
if 2 == len(first_split):
parser.set_defaults(prompt=first_split[1])
for section in first_split[0].split('; '):