LPX55 commited on
Commit
a62a062
·
verified ·
1 Parent(s): 8abcdbd

Update app_local.py

Browse files
Files changed (1) hide show
  1. app_local.py +95 -100
app_local.py CHANGED
@@ -517,95 +517,6 @@ with gr.Blocks(title="'Qwen Image Edit' Model Playground & Showcase [4-Step Ligh
517
  type="pil",
518
  height=300
519
  )
520
-
521
- prompt = gr.Textbox(
522
- label="Edit Instructions / Base Prompt",
523
- placeholder="e.g. Replace the background with a beach sunset... When a preset is selected, use as the base prompt, e.g. the lamborghini",
524
- lines=2,
525
- max_lines=4,
526
- scale=2
527
- )
528
-
529
- preset_dropdown = gr.Dropdown(
530
- choices=get_preset_choices(),
531
- value=None,
532
- label="Preset Batch Generation",
533
- interactive=True
534
- )
535
- # Add editable preset prompts (initially hidden)
536
- preset_editor = gr.Group(visible=False)
537
- with preset_editor:
538
- gr.Markdown("### 🎨 Edit Preset Prompts")
539
- preset_prompt_1 = gr.Textbox(label="Prompt 1", lines=1, value="")
540
- preset_prompt_2 = gr.Textbox(label="Prompt 2", lines=1, value="")
541
- preset_prompt_3 = gr.Textbox(label="Prompt 3", lines=1, value="")
542
- preset_prompt_4 = gr.Textbox(label="Prompt 4", lines=1, value="")
543
-
544
- update_preset_button = gr.Button("Update Preset", variant="secondary", visible=False)
545
- reset_button = gr.Button("Reset Presets", variant="stop", visible=False)
546
-
547
-
548
-
549
- # Add prompt preview component
550
- prompt_preview = gr.Textbox(
551
- label="📋 Prompt Preview",
552
- interactive=False,
553
- lines=6,
554
- max_lines=10,
555
- value="Enter a base prompt and select a preset above to see how your prompt will be modified for batch generation.",
556
- placeholder="Prompt preview will appear here..."
557
- )
558
-
559
- rewrite_toggle = gr.Checkbox(
560
- label="Additional Prompt Enhancement",
561
- info="Setting this to true will pass the basic prompt(s) generated via the static preset template to a secondary LLM tasked with improving the overall cohesiveness and details of the final generation prompt.",
562
- value=True,
563
- interactive=True
564
- )
565
-
566
- run_button = gr.Button(
567
- "Generate Edit(s)",
568
- variant="primary"
569
- )
570
- with gr.Accordion("Advanced Parameters", open=False):
571
- with gr.Row():
572
- seed = gr.Slider(
573
- label="Seed",
574
- minimum=0,
575
- maximum=MAX_SEED,
576
- step=1,
577
- value=42
578
- )
579
- randomize_seed = gr.Checkbox(
580
- label="Random Seed",
581
- value=True
582
- )
583
- with gr.Row():
584
- true_guidance_scale = gr.Slider(
585
- label="True CFG Scale",
586
- minimum=1.0,
587
- maximum=10.0,
588
- step=0.1,
589
- value=1.1
590
- )
591
- num_inference_steps = gr.Slider(
592
- label="Inference Steps",
593
- minimum=1,
594
- maximum=16,
595
- step=1,
596
- value=3
597
- )
598
-
599
- num_images_per_prompt = gr.Slider(
600
- label="Output Count (Manual)",
601
- minimum=1,
602
- maximum=4,
603
- step=1,
604
- value=2,
605
- interactive=True
606
- )
607
-
608
- # Output Column
609
  with gr.Column(scale=2):
610
  result = gr.Gallery(
611
  label="Edited Images",
@@ -614,18 +525,102 @@ with gr.Blocks(title="'Qwen Image Edit' Model Playground & Showcase [4-Step Ligh
614
  object_fit="contain",
615
  container=True
616
  )
617
- prompt_info = gr.HTML(
618
- value="<div style='padding:15px; margin-top:15px'>"
619
- "Hint: depending on the original image, prompt quality, and complexity, you can often get away with 3 steps, even 2 steps without much loss in quality. </div>"
620
- )
621
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
 
623
- gr.Markdown("""
624
- <div style="text-align: center; background: linear-gradient(to right, #3a7bd5, #00d2ff); color: white; padding: 20px; border-radius: 8px;">
625
- <p>✨ 4-step inferencing with lightx2v's LoRA.</p>
626
- <p>📝 Local Prompt Enhancement, Batched Multi-image Generation, 🎨 Preset Batches</p>
627
- </div>
628
- """)
629
 
630
  def show_preset_editor(preset_type):
631
  if preset_type and preset_type in preset_state.value:
 
517
  type="pil",
518
  height=300
519
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  with gr.Column(scale=2):
521
  result = gr.Gallery(
522
  label="Edited Images",
 
525
  object_fit="contain",
526
  container=True
527
  )
528
+ with gr.Row():
529
+ with gr.Column(scale=1):
530
+ prompt = gr.Textbox(
531
+ label="Edit Instructions / Base Prompt",
532
+ placeholder="e.g. Replace the background with a beach sunset... When a preset is selected, use as the base prompt, e.g. the lamborghini",
533
+ lines=2,
534
+ max_lines=4,
535
+ scale=2
536
+ )
537
+
538
+ preset_dropdown = gr.Dropdown(
539
+ choices=get_preset_choices(),
540
+ value=None,
541
+ label="Preset Batch Generation",
542
+ interactive=True
543
+ )
544
+ # Add editable preset prompts (initially hidden)
545
+ preset_editor = gr.Group(visible=False)
546
+ with preset_editor:
547
+ gr.Markdown("### 🎨 Edit Preset Prompts")
548
+ preset_prompt_1 = gr.Textbox(label="Prompt 1", lines=1, value="")
549
+ preset_prompt_2 = gr.Textbox(label="Prompt 2", lines=1, value="")
550
+ preset_prompt_3 = gr.Textbox(label="Prompt 3", lines=1, value="")
551
+ preset_prompt_4 = gr.Textbox(label="Prompt 4", lines=1, value="")
552
+
553
+ update_preset_button = gr.Button("Update Preset", variant="secondary", visible=False)
554
+ reset_button = gr.Button("Reset Presets", variant="stop", visible=False)
555
+
556
+
557
+
558
+ # Add prompt preview component
559
+ prompt_preview = gr.Textbox(
560
+ label="📋 Prompt Preview",
561
+ interactive=False,
562
+ lines=6,
563
+ max_lines=10,
564
+ value="Enter a base prompt and select a preset above to see how your prompt will be modified for batch generation.",
565
+ placeholder="Prompt preview will appear here..."
566
+ )
567
+
568
+ rewrite_toggle = gr.Checkbox(
569
+ label="Additional Prompt Enhancement",
570
+ info="Setting this to true will pass the basic prompt(s) generated via the static preset template to a secondary LLM tasked with improving the overall cohesiveness and details of the final generation prompt.",
571
+ value=True,
572
+ interactive=True
573
+ )
574
+
575
+ run_button = gr.Button(
576
+ "Generate Edit(s)",
577
+ variant="primary"
578
+ )
579
+ with gr.Accordion("Advanced Parameters", open=False):
580
+ with gr.Row():
581
+ seed = gr.Slider(
582
+ label="Seed",
583
+ minimum=0,
584
+ maximum=MAX_SEED,
585
+ step=1,
586
+ value=42
587
+ )
588
+ randomize_seed = gr.Checkbox(
589
+ label="Random Seed",
590
+ value=True
591
+ )
592
+ with gr.Row():
593
+ true_guidance_scale = gr.Slider(
594
+ label="True CFG Scale",
595
+ minimum=1.0,
596
+ maximum=10.0,
597
+ step=0.1,
598
+ value=1.1
599
+ )
600
+ num_inference_steps = gr.Slider(
601
+ label="Inference Steps",
602
+ minimum=1,
603
+ maximum=16,
604
+ step=1,
605
+ value=3
606
+ )
607
+
608
+ num_images_per_prompt = gr.Slider(
609
+ label="Output Count (Manual)",
610
+ minimum=1,
611
+ maximum=4,
612
+ step=1,
613
+ value=2,
614
+ interactive=True
615
+ )
616
+
617
+
618
+
619
+ prompt_info = gr.Markdown(
620
+ value="<div style='padding:15px; margin-top:15px'>"
621
+ "Hint: depending on the original image, prompt quality, and complexity, you can often get away with 3 steps, even 2 steps without much loss in quality. </div>"
622
+ )
623
 
 
 
 
 
 
 
624
 
625
  def show_preset_editor(preset_type):
626
  if preset_type and preset_type in preset_state.value: