Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,8 @@ pipe = FluxKontextPipeline.from_pretrained(
|
|
| 28 |
torch_dtype=dtype
|
| 29 |
).to(device)
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
print("📅 Using Euler scheduler (matching ComfyUI)")
|
| 34 |
|
| 35 |
pipe.load_lora_weights(
|
| 36 |
"DoozyWo/Kontext_avatar_LoRA",
|
|
@@ -103,13 +102,12 @@ def transform_to_avatar(input_image, custom_prompt="", guidance_scale=1.0, num_i
|
|
| 103 |
|
| 104 |
print(f"Avatar transformation prompt: {prompt_with_template}")
|
| 105 |
|
| 106 |
-
# Match ComfyUI parameters
|
|
|
|
| 107 |
image = pipe(
|
| 108 |
image=scaled_image,
|
| 109 |
prompt=prompt_with_template,
|
| 110 |
guidance_scale=guidance_scale, # CFG=1 from ComfyUI
|
| 111 |
-
width=scaled_image.size[0],
|
| 112 |
-
height=scaled_image.size[1],
|
| 113 |
num_inference_steps=num_inference_steps,
|
| 114 |
generator=torch.Generator(device=pipe.device).manual_seed(seed),
|
| 115 |
).images[0]
|
|
|
|
| 28 |
torch_dtype=dtype
|
| 29 |
).to(device)
|
| 30 |
|
| 31 |
+
# Keep the default scheduler that works with FluxKontextPipeline
|
| 32 |
+
print(f"📅 Using default scheduler: {pipe.scheduler.__class__.__name__}")
|
|
|
|
| 33 |
|
| 34 |
pipe.load_lora_weights(
|
| 35 |
"DoozyWo/Kontext_avatar_LoRA",
|
|
|
|
| 102 |
|
| 103 |
print(f"Avatar transformation prompt: {prompt_with_template}")
|
| 104 |
|
| 105 |
+
# Match ComfyUI parameters: cfg=1, steps=25
|
| 106 |
+
# Let the pipeline handle dimensions automatically
|
| 107 |
image = pipe(
|
| 108 |
image=scaled_image,
|
| 109 |
prompt=prompt_with_template,
|
| 110 |
guidance_scale=guidance_scale, # CFG=1 from ComfyUI
|
|
|
|
|
|
|
| 111 |
num_inference_steps=num_inference_steps,
|
| 112 |
generator=torch.Generator(device=pipe.device).manual_seed(seed),
|
| 113 |
).images[0]
|