summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Berwaldt <zberwaldt@tutamail.com>2024-10-29 23:48:54 -0400
committerZach Berwaldt <zberwaldt@tutamail.com>2024-10-29 23:48:54 -0400
commit23b68c871d95353258d180639fa30b636a982423 (patch)
treee10f7953ee02fb334033ba2e2c3ef8aff6367849
parent47084f8024b2be503f5abe0c0464512a226b7356 (diff)
add requirements.txt, update script
-rw-r--r--requirements.txtbin0 -> 1328 bytes
-rw-r--r--run_flux.py8
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
4import argparse 4import argparse
5from diffusers import FluxPipeline 5from diffusers import FluxPipeline
6from typing import Tuple 6from typing import Tuple
7from pathlib import Path
7import uuid 8import uuid
8 9
10STORAGE_DIR: Path = Path.home() / "Pictures" / "Flux"
11
12STORAGE_DIR.mkdir(parents=True, exist_ok=True)
13
9def load_flux(): 14def 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)