diff options
author | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-10-29 23:48:54 -0400 |
---|---|---|
committer | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-10-29 23:48:54 -0400 |
commit | 23b68c871d95353258d180639fa30b636a982423 (patch) | |
tree | e10f7953ee02fb334033ba2e2c3ef8aff6367849 | |
parent | 47084f8024b2be503f5abe0c0464512a226b7356 (diff) |
add requirements.txt, update script
-rw-r--r-- | requirements.txt | bin | 0 -> 1328 bytes | |||
-rw-r--r-- | run_flux.py | 8 |
2 files changed, 7 insertions, 1 deletions
diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7eeb770 --- /dev/null +++ b/requirements.txt | |||
Binary files 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 | |||
4 | import argparse | 4 | import argparse |
5 | from diffusers import FluxPipeline | 5 | from diffusers import FluxPipeline |
6 | from typing import Tuple | 6 | from typing import Tuple |
7 | from pathlib import Path | ||
7 | import uuid | 8 | import uuid |
8 | 9 | ||
10 | STORAGE_DIR: Path = Path.home() / "Pictures" / "Flux" | ||
11 | |||
12 | STORAGE_DIR.mkdir(parents=True, exist_ok=True) | ||
13 | |||
9 | def load_flux(): | 14 | def load_flux(): |
10 | pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16) | 15 | pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16) |
11 | pipeline.enable_model_cpu_offload() | 16 | pipeline.enable_model_cpu_offload() |
@@ -47,7 +52,8 @@ def main(): | |||
47 | images = generate_image(pipeline, prompt=args.prompt, width=width, height=height, guideance_scale=args.guideance_scale, num_images_per_prompt=args.number) | 52 | images = generate_image(pipeline, prompt=args.prompt, width=width, height=height, guideance_scale=args.guideance_scale, num_images_per_prompt=args.number) |
48 | for image in images: | 53 | for image in images: |
49 | filename = generate_random_string() | 54 | filename = generate_random_string() |
50 | image.save(f"{filename}.png") | 55 | filepath = STORAGE_DIR / f"{filename}.png" |
56 | image.save(filepath) | ||
51 | except KeyboardInterrupt: | 57 | except KeyboardInterrupt: |
52 | print('\nExiting early...') | 58 | print('\nExiting early...') |
53 | exit(0) | 59 | exit(0) |