diff options
| author | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-10-31 00:08:06 -0400 |
|---|---|---|
| committer | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-10-31 00:08:06 -0400 |
| commit | 72ed6fd218173036a6e9bd273dc220db1135fc96 (patch) | |
| tree | 6f90a55022d7eb9e98dd249008d932df0647fb3b | |
| parent | ffbc2e788c113b278b9306aac4cea1d644eaf048 (diff) | |
add strength argument
| -rw-r--r-- | prompts.txt | 3 | ||||
| -rw-r--r-- | run_flux.py | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/prompts.txt b/prompts.txt index 3268a51..5fa318a 100644 --- a/prompts.txt +++ b/prompts.txt | |||
| @@ -1,2 +1,5 @@ | |||
| 1 | A space pilot, wearing her space flight suit, graying hair, determined to face the future. | 1 | A space pilot, wearing her space flight suit, graying hair, determined to face the future. |
| 2 | Female with very large breasts. | 2 | Female with very large breasts. |
| 3 | Oil painting, full-body shot. Woman, plump, long flowing green dress, trimmed in gold. Long light-brown hair, brown eyes | ||
| 4 | Full-body shot. Mom, with glasses, holding a coffee | ||
| 5 | Marching band dad, lower back pain | ||
diff --git a/run_flux.py b/run_flux.py index 89d188b..b288935 100644 --- a/run_flux.py +++ b/run_flux.py | |||
| @@ -52,7 +52,7 @@ def load_flux(): | |||
| 52 | pipeline.vae.enable_tiling() | 52 | pipeline.vae.enable_tiling() |
| 53 | return pipeline | 53 | return pipeline |
| 54 | 54 | ||
| 55 | def generate_image(pipeline, prompt, prompt_2=None, init_image=None, height=1024, width=1024, guideance_scale=0, num_images_per_prompt=1, num_inference_steps=50): | 55 | def generate_image(pipeline, prompt, strength=None, prompt_2=None, init_image=None, height=1024, width=1024, guideance_scale=0, num_images_per_prompt=1, num_inference_steps=50): |
| 56 | kwargs = { | 56 | kwargs = { |
| 57 | "prompt": prompt, | 57 | "prompt": prompt, |
| 58 | "prompt_2": prompt_2, | 58 | "prompt_2": prompt_2, |
| @@ -64,6 +64,9 @@ def generate_image(pipeline, prompt, prompt_2=None, init_image=None, height=1024 | |||
| 64 | "num_images_per_prompt": num_images_per_prompt | 64 | "num_images_per_prompt": num_images_per_prompt |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | if strength: | ||
| 68 | kwargs["strength"] = strength | ||
| 69 | |||
| 67 | if isinstance(pipeline, FluxImg2ImgPipeline) and init_image is not None: | 70 | if isinstance(pipeline, FluxImg2ImgPipeline) and init_image is not None: |
| 68 | kwargs["image"] = init_image | 71 | kwargs["image"] = init_image |
| 69 | 72 | ||
| @@ -106,7 +109,7 @@ def main(): | |||
| 106 | 109 | ||
| 107 | image = Image.open(target_img_path) | 110 | image = Image.open(target_img_path) |
| 108 | 111 | ||
| 109 | init_image = load_image(image).resize((256, 256)) | 112 | init_image = load_image(image).resize((1024, 1024)) |
| 110 | 113 | ||
| 111 | width, height = args.size | 114 | width, height = args.size |
| 112 | 115 | ||
| @@ -123,6 +126,7 @@ def main(): | |||
| 123 | prompt_2=args.prompt2, | 126 | prompt_2=args.prompt2, |
| 124 | width=width, | 127 | width=width, |
| 125 | height=height, | 128 | height=height, |
| 129 | strength=args.strength, | ||
| 126 | guideance_scale=args.guideance_scale, | 130 | guideance_scale=args.guideance_scale, |
| 127 | num_images_per_prompt=args.number | 131 | num_images_per_prompt=args.number |
| 128 | ) | 132 | ) |
| @@ -151,6 +155,7 @@ parser.add_argument("-o", "--output", type=str, default="image", help="the name | |||
| 151 | parser.add_argument("-p", "--prompt", type=str, required=True, help="the prompt") | 155 | parser.add_argument("-p", "--prompt", type=str, required=True, help="the prompt") |
| 152 | parser.add_argument("-p2", "--prompt2", type=str, help="A second prompt") | 156 | parser.add_argument("-p2", "--prompt2", type=str, help="A second prompt") |
| 153 | parser.add_argument("-gs", "--guideance-scale", type=float, default=0) | 157 | parser.add_argument("-gs", "--guideance-scale", type=float, default=0) |
| 158 | parser.add_argument("--strength", type=float) | ||
| 154 | parser.add_argument("--size", type=parse_dimensions, default="1024:1024", help="the size of the output images") | 159 | parser.add_argument("--size", type=parse_dimensions, default="1024:1024", help="the size of the output images") |
| 155 | parser.add_argument("-u", "--use-image", action="store_true", help="use a predefined image") | 160 | parser.add_argument("-u", "--use-image", action="store_true", help="use a predefined image") |
| 156 | 161 | ||
