Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,8 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
| 14 |
MAX_IMAGE_SIZE = 2048
|
| 15 |
|
| 16 |
pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16).to("cuda")
|
|
|
|
|
|
|
| 17 |
|
| 18 |
def calculate_optimal_dimensions(image: Image.Image):
|
| 19 |
# Extract the original dimensions
|
|
@@ -67,7 +69,8 @@ def infer(edit_images, prompt, seed=42, randomize_seed=False, width=1024, height
|
|
| 67 |
width=width,
|
| 68 |
guidance_scale=guidance_scale,
|
| 69 |
num_inference_steps=num_inference_steps,
|
| 70 |
-
generator=torch.Generator("cpu").manual_seed(seed)
|
|
|
|
| 71 |
).images[0]
|
| 72 |
|
| 73 |
output_image_jpg = image.convert("RGB")
|
|
|
|
| 14 |
MAX_IMAGE_SIZE = 2048
|
| 15 |
|
| 16 |
pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16).to("cuda")
|
| 17 |
+
pipe.load_lora_weights("alvdansen/flux-koda")
|
| 18 |
+
pipe.enable_sequential_cpu_offload()
|
| 19 |
|
| 20 |
def calculate_optimal_dimensions(image: Image.Image):
|
| 21 |
# Extract the original dimensions
|
|
|
|
| 69 |
width=width,
|
| 70 |
guidance_scale=guidance_scale,
|
| 71 |
num_inference_steps=num_inference_steps,
|
| 72 |
+
generator=torch.Generator("cpu").manual_seed(seed),
|
| 73 |
+
lora_scale=0.75
|
| 74 |
).images[0]
|
| 75 |
|
| 76 |
output_image_jpg = image.convert("RGB")
|