summaryrefslogtreecommitdiff
path: root/run_flux.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_flux.py')
-rw-r--r--run_flux.py9
1 files changed, 7 insertions, 2 deletions
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
55def 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): 55def 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
151parser.add_argument("-p", "--prompt", type=str, required=True, help="the prompt") 155parser.add_argument("-p", "--prompt", type=str, required=True, help="the prompt")
152parser.add_argument("-p2", "--prompt2", type=str, help="A second prompt") 156parser.add_argument("-p2", "--prompt2", type=str, help="A second prompt")
153parser.add_argument("-gs", "--guideance-scale", type=float, default=0) 157parser.add_argument("-gs", "--guideance-scale", type=float, default=0)
158parser.add_argument("--strength", type=float)
154parser.add_argument("--size", type=parse_dimensions, default="1024:1024", help="the size of the output images") 159parser.add_argument("--size", type=parse_dimensions, default="1024:1024", help="the size of the output images")
155parser.add_argument("-u", "--use-image", action="store_true", help="use a predefined image") 160parser.add_argument("-u", "--use-image", action="store_true", help="use a predefined image")
156 161