Husr commited on
Commit
d96ae75
·
1 Parent(s): 94ea93d
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -370,12 +370,17 @@ def warmup_model(pipeline: ZImagePipeline, resolutions: List[str]) -> None:
370
  prompt=dummy_prompt,
371
  resolution=res_str,
372
  seed=42,
373
- steps=6,
374
  shift=3.0,
375
  guidance_scale=0.0,
376
  max_sequence_length=512,
377
  use_lora=False,
378
  lora_scale=0.0,
 
 
 
 
 
379
  )
380
  except Exception as exc: # noqa: BLE001
381
  print(f"Warmup failed for {res_str}: {exc}")
@@ -404,7 +409,7 @@ def generate(
404
  prompt: str,
405
  resolution: str = "1024x1024 ( 1:1 )",
406
  seed: int = 42,
407
- steps: int = 9,
408
  shift: float = 3.0,
409
  cfg: float = DEFAULT_CFG,
410
  scheduler_name: str = "FlowMatch Euler",
@@ -430,7 +435,7 @@ def generate(
430
  prompt=prompt,
431
  resolution=resolution.split(" ")[0] if " " in resolution else resolution,
432
  seed=new_seed,
433
- steps=int(steps),
434
  shift=float(shift),
435
  guidance_scale=float(cfg),
436
  max_sequence_length=int(max_sequence_length),
@@ -472,7 +477,7 @@ Model: `{MODEL_PATH}` | {pipe_status}
472
 
473
  with gr.Row():
474
  with gr.Column(scale=1):
475
- prompt_input = gr.Textbox(label="Prompt", lines=3, placeholder="请输入提示词")
476
 
477
  with gr.Row():
478
  choices = [int(k) for k in RES_CHOICES.keys()]
@@ -489,7 +494,7 @@ Model: `{MODEL_PATH}` | {pipe_status}
489
 
490
  with gr.Accordion("KSampler / Advanced", open=False):
491
  with gr.Row():
492
- steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=9, step=1)
493
  cfg = gr.Slider(label="CFG", minimum=0.0, maximum=10.0, value=DEFAULT_CFG, step=0.1)
494
 
495
  with gr.Row():
@@ -507,7 +512,7 @@ Model: `{MODEL_PATH}` | {pipe_status}
507
  )
508
 
509
  with gr.Row():
510
- shift = gr.Slider(label="Shift", minimum=0.0, maximum=10.0, value=3.0, step=0.1)
511
  use_dynamic_shifting = gr.Checkbox(label="use_dynamic_shifting", value=False)
512
 
513
  with gr.Row():
@@ -517,19 +522,19 @@ Model: `{MODEL_PATH}` | {pipe_status}
517
  max_seq = gr.Slider(label="Max Sequence Length", minimum=256, maximum=1024, value=512, step=16)
518
 
519
  with gr.Row():
520
- use_lora = gr.Checkbox(label="Use LoRA", value=True, interactive=lora_loaded)
521
  lora_strength = gr.Slider(
522
  label="LoRA Strength",
523
  minimum=0.0,
524
  maximum=1.5,
525
  value=1.0,
526
  step=0.05,
527
- interactive=lora_loaded,
528
  )
529
 
530
  generate_btn = gr.Button("Generate", variant="primary")
531
 
532
- gr.Markdown("### 示例提示词")
533
  gr.Examples(examples=EXAMPLE_PROMPTS, inputs=prompt_input, label=None)
534
 
535
  with gr.Column(scale=1):
 
370
  prompt=dummy_prompt,
371
  resolution=res_str,
372
  seed=42,
373
+ steps=9,
374
  shift=3.0,
375
  guidance_scale=0.0,
376
  max_sequence_length=512,
377
  use_lora=False,
378
  lora_scale=0.0,
379
+ scheduler_name="FlowMatch Euler",
380
+ num_train_timesteps=1000,
381
+ use_dynamic_shifting=False,
382
+ base_shift=0.5,
383
+ max_shift=3.0,
384
  )
385
  except Exception as exc: # noqa: BLE001
386
  print(f"Warmup failed for {res_str}: {exc}")
 
409
  prompt: str,
410
  resolution: str = "1024x1024 ( 1:1 )",
411
  seed: int = 42,
412
+ steps: int = 8,
413
  shift: float = 3.0,
414
  cfg: float = DEFAULT_CFG,
415
  scheduler_name: str = "FlowMatch Euler",
 
435
  prompt=prompt,
436
  resolution=resolution.split(" ")[0] if " " in resolution else resolution,
437
  seed=new_seed,
438
+ steps=int(steps) + 1,
439
  shift=float(shift),
440
  guidance_scale=float(cfg),
441
  max_sequence_length=int(max_sequence_length),
 
477
 
478
  with gr.Row():
479
  with gr.Column(scale=1):
480
+ prompt_input = gr.Textbox(label="Prompt", lines=3, placeholder="Enter your prompt here...")
481
 
482
  with gr.Row():
483
  choices = [int(k) for k in RES_CHOICES.keys()]
 
494
 
495
  with gr.Accordion("KSampler / Advanced", open=False):
496
  with gr.Row():
497
+ steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=8, step=1)
498
  cfg = gr.Slider(label="CFG", minimum=0.0, maximum=10.0, value=DEFAULT_CFG, step=0.1)
499
 
500
  with gr.Row():
 
512
  )
513
 
514
  with gr.Row():
515
+ shift = gr.Slider(label="Time Shift", minimum=1.0, maximum=10.0, value=3.0, step=0.1)
516
  use_dynamic_shifting = gr.Checkbox(label="use_dynamic_shifting", value=False)
517
 
518
  with gr.Row():
 
522
  max_seq = gr.Slider(label="Max Sequence Length", minimum=256, maximum=1024, value=512, step=16)
523
 
524
  with gr.Row():
525
+ use_lora = gr.Checkbox(label="Use LoRA", value=True, interactive=True)
526
  lora_strength = gr.Slider(
527
  label="LoRA Strength",
528
  minimum=0.0,
529
  maximum=1.5,
530
  value=1.0,
531
  step=0.05,
532
+ interactive=True,
533
  )
534
 
535
  generate_btn = gr.Button("Generate", variant="primary")
536
 
537
+ gr.Markdown("### 📝 Example Prompts")
538
  gr.Examples(examples=EXAMPLE_PROMPTS, inputs=prompt_input, label=None)
539
 
540
  with gr.Column(scale=1):