MogensR commited on
Commit
bc45f7d
Β·
1 Parent(s): 753ffed

Update ui/ui_components.py

Browse files
Files changed (1) hide show
  1. ui/ui_components.py +7 -17
ui/ui_components.py CHANGED
@@ -1,15 +1,10 @@
1
  #!/usr/bin/env python3
2
  """
3
- UI Components for BackgroundFX Pro
4
- ----------------------------------
5
  * Pure layout: no heavy logic
6
  * All callbacks live in ui/callbacks.py
7
- * Removed first-frame video preview (redundant)
8
- * Improved background section with:
9
- a) Upload file option
10
- b) Pre-loaded professional images (dropdown)
11
- c) Pre-loaded gradients & full colors (dropdown)
12
- d) AI-generated background option (inline)
13
  """
14
 
15
  from __future__ import annotations
@@ -40,7 +35,6 @@
40
  """
41
 
42
  # Keep in sync with utils/cv_processing.PROFESSIONAL_BACKGROUNDS
43
- # (We split existing keys into two UI groups without inventing new keys)
44
  _BG_CHOICES = [
45
  "minimalist",
46
  "office_modern",
@@ -165,10 +159,6 @@ def create_interface() -> gr.Blocks:
165
 
166
  # ── Advanced options accordion ───────────────────────
167
  with gr.Accordion("Advanced", open=False):
168
- use_two_stage = gr.Checkbox(
169
- label="Use Two-Stage Pipeline",
170
- value=False
171
- )
172
  chroma_preset = gr.Dropdown(
173
  label="Chroma Preset",
174
  choices=["standard"], # can add 'studio', 'outdoor' later
@@ -239,14 +229,14 @@ def _toggle_bg_sections(choice: str):
239
  # Load models
240
  btn_load.click(cb_load_models, outputs=statusbox)
241
 
242
- # Process video
243
  btn_run.click(
244
  cb_process_video,
245
  inputs=[
246
  video,
247
- bg_style, # kept for compatibility; ignored if custom_bg is set
248
- custom_bg, # becomes the effective background in all methods
249
- use_two_stage,
250
  chroma_preset,
251
  key_color_mode,
252
  preview_mask,
 
1
  #!/usr/bin/env python3
2
  """
3
+ UI Components for BackgroundFX Pro (forced Two-Stage)
4
+ -----------------------------------------------------
5
  * Pure layout: no heavy logic
6
  * All callbacks live in ui/callbacks.py
7
+ * Two-stage mode is always active (checkbox removed)
 
 
 
 
 
8
  """
9
 
10
  from __future__ import annotations
 
35
  """
36
 
37
  # Keep in sync with utils/cv_processing.PROFESSIONAL_BACKGROUNDS
 
38
  _BG_CHOICES = [
39
  "minimalist",
40
  "office_modern",
 
159
 
160
  # ── Advanced options accordion ───────────────────────
161
  with gr.Accordion("Advanced", open=False):
 
 
 
 
162
  chroma_preset = gr.Dropdown(
163
  label="Chroma Preset",
164
  choices=["standard"], # can add 'studio', 'outdoor' later
 
229
  # Load models
230
  btn_load.click(cb_load_models, outputs=statusbox)
231
 
232
+ # Always two-stage: pass use_two_stage=True to callback
233
  btn_run.click(
234
  cb_process_video,
235
  inputs=[
236
  video,
237
+ bg_style,
238
+ custom_bg,
239
+ gr.State(value=True), # Always two-stage
240
  chroma_preset,
241
  key_color_mode,
242
  preview_mask,