From 23b68c871d95353258d180639fa30b636a982423 Mon Sep 17 00:00:00 2001 From: Zach Berwaldt Date: Tue, 29 Oct 2024 23:48:54 -0400 Subject: add requirements.txt, update script --- requirements.txt | Bin 0 -> 1328 bytes run_flux.py | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7eeb770 Binary files /dev/null and b/requirements.txt differ diff --git a/run_flux.py b/run_flux.py index c095fce..8c4c27e 100644 --- a/run_flux.py +++ b/run_flux.py @@ -4,8 +4,13 @@ import base64 import argparse from diffusers import FluxPipeline from typing import Tuple +from pathlib import Path import uuid +STORAGE_DIR: Path = Path.home() / "Pictures" / "Flux" + +STORAGE_DIR.mkdir(parents=True, exist_ok=True) + def load_flux(): pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16) pipeline.enable_model_cpu_offload() @@ -47,7 +52,8 @@ def main(): images = generate_image(pipeline, prompt=args.prompt, width=width, height=height, guideance_scale=args.guideance_scale, num_images_per_prompt=args.number) for image in images: filename = generate_random_string() - image.save(f"{filename}.png") + filepath = STORAGE_DIR / f"{filename}.png" + image.save(filepath) except KeyboardInterrupt: print('\nExiting early...') exit(0) -- cgit v1.1