DoozyWo commited on
Commit
a3b3011
·
verified ·
1 Parent(s): fdb4edf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -28,9 +28,8 @@ pipe = FluxKontextPipeline.from_pretrained(
28
  torch_dtype=dtype
29
  ).to(device)
30
 
31
- # Set scheduler to match ComfyUI (Euler with simple scheduler)
32
- pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)
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 exactly: cfg=1, steps=25, sampler=euler, scheduler=simple
 
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]