diff options
Diffstat (limited to 'infer.py')
| -rw-r--r-- | infer.py | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -264,16 +264,16 @@ def generate(output_dir: Path, pipeline, args): | |||
| 264 | 264 | ||
| 265 | if len(args.prompt) != 1: | 265 | if len(args.prompt) != 1: |
| 266 | if len(args.project) != 0: | 266 | if len(args.project) != 0: |
| 267 | output_dir = output_dir.joinpath(f"{now}_{slugify(args.project)}") | 267 | output_dir = output_dir / f"{now}_{slugify(args.project)}" |
| 268 | else: | 268 | else: |
| 269 | output_dir = output_dir.joinpath(now) | 269 | output_dir = output_dir / now |
| 270 | 270 | ||
| 271 | for prompt in args.prompt: | 271 | for prompt in args.prompt: |
| 272 | dir = output_dir.joinpath(slugify(prompt)[:100]) | 272 | dir = output_dir / slugify(prompt)[:100] |
| 273 | dir.mkdir(parents=True, exist_ok=True) | 273 | dir.mkdir(parents=True, exist_ok=True) |
| 274 | image_dir.append(dir) | 274 | image_dir.append(dir) |
| 275 | else: | 275 | else: |
| 276 | output_dir = output_dir.joinpath(f"{now}_{slugify(args.prompt[0])[:100]}") | 276 | output_dir = output_dir / f"{now}_{slugify(args.prompt[0])[:100]}" |
| 277 | output_dir.mkdir(parents=True, exist_ok=True) | 277 | output_dir.mkdir(parents=True, exist_ok=True) |
| 278 | image_dir.append(output_dir) | 278 | image_dir.append(output_dir) |
| 279 | 279 | ||
| @@ -332,9 +332,9 @@ def generate(output_dir: Path, pipeline, args): | |||
| 332 | basename = f"{seed}_{j // len(args.prompt)}" | 332 | basename = f"{seed}_{j // len(args.prompt)}" |
| 333 | dir = image_dir[j % len(args.prompt)] | 333 | dir = image_dir[j % len(args.prompt)] |
| 334 | 334 | ||
| 335 | image.save(dir.joinpath(f"{basename}.png")) | 335 | image.save(dir / f"{basename}.png") |
| 336 | image.save(dir.joinpath(f"{basename}.jpg"), quality=85) | 336 | image.save(dir / f"{basename}.jpg", quality=85) |
| 337 | with open(dir.joinpath(f"{basename}.txt"), 'w') as f: | 337 | with open(dir / f"{basename}.txt", 'w') as f: |
| 338 | f.write(prompt[j % len(args.prompt)]) | 338 | f.write(prompt[j % len(args.prompt)]) |
| 339 | 339 | ||
| 340 | if torch.cuda.is_available(): | 340 | if torch.cuda.is_available(): |
