Spaces:
Running on Zero
Running on Zero
Default harmonize step k6, concise tags, punchier header
Browse files
app.py
CHANGED
|
@@ -48,7 +48,7 @@ BUDGETS = {
|
|
| 48 |
"Fast 路 512": (512, 512 * 896),
|
| 49 |
}
|
| 50 |
DEFAULT_BUDGET = "Balanced 路 640"
|
| 51 |
-
DEFAULT_HARMONIZE_STEP =
|
| 52 |
OUTPUT_DIR = os.path.join(tempfile.gettempdir(), "bgswap-outputs")
|
| 53 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 54 |
|
|
@@ -517,28 +517,24 @@ def run_classic(clip, prompt, budget, steps, seed, keep_audio, harmonize, harmon
|
|
| 517 |
|
| 518 |
with gr.Blocks(title="Video Replace Background") as demo:
|
| 519 |
gr.Markdown(
|
| 520 |
-
"# Video Replace Background\n"
|
| 521 |
-
"
|
| 522 |
-
"[LTX-2.5 Alpha-Gen matte](https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Alpha-Gen)
|
| 523 |
-
"
|
| 524 |
-
"([inpainting
|
| 525 |
-
"[turbo LoRA](https://huggingface.co/lightx2v/Minimax-h3-Turbo))
|
| 526 |
-
"**Harmonize**
|
| 527 |
-
"together and the subject's lighting matches the new scene, the main cure for the cutout look."
|
| 528 |
)
|
| 529 |
with gr.Row():
|
| 530 |
with gr.Column():
|
| 531 |
clip = gr.Video(label="Clip with a clear subject")
|
| 532 |
remove_bg = gr.Checkbox(value=False, label="Just remove the background (skip generating a new one)")
|
| 533 |
prompt = gr.Textbox(label="New background", placeholder="a sunny tropical beach, palm trees, ocean waves")
|
| 534 |
-
harmonize = gr.Checkbox(value=True, label="Harmonize
|
| 535 |
-
info="
|
| 536 |
-
"refines together with the new background and its lighting matches - the "
|
| 537 |
-
"cure for the cutout look (recommended). No extra cost, it's one pass.")
|
| 538 |
harmonize_step = gr.Slider(
|
| 539 |
-
1, 27, value=DEFAULT_HARMONIZE_STEP, step=1, label="Harmonize: drop
|
| 540 |
-
info="
|
| 541 |
-
"the original, earlier = stronger relighting. Clamped below your step count.")
|
| 542 |
with gr.Accordion("Settings", open=False):
|
| 543 |
budget = gr.Dropdown(list(BUDGETS), value=DEFAULT_BUDGET, label="Quality / speed")
|
| 544 |
steps = gr.Slider(4, 28, value=DEFAULT_STEPS, step=1, label="Steps (turbo)")
|
|
|
|
| 48 |
"Fast 路 512": (512, 512 * 896),
|
| 49 |
}
|
| 50 |
DEFAULT_BUDGET = "Balanced 路 640"
|
| 51 |
+
DEFAULT_HARMONIZE_STEP = 6 # harmonize: drop the mask at this denoise step by default (of 8; later = more faithful, earlier = more relight)
|
| 52 |
OUTPUT_DIR = os.path.join(tempfile.gettempdir(), "bgswap-outputs")
|
| 53 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 54 |
|
|
|
|
| 517 |
|
| 518 |
with gr.Blocks(title="Video Replace Background") as demo:
|
| 519 |
gr.Markdown(
|
| 520 |
+
"# 馃幀 Video Replace Background\n"
|
| 521 |
+
"Drop your subject into a brand-new world. The "
|
| 522 |
+
"[LTX-2.5 Alpha-Gen matte](https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Alpha-Gen) lifts them out, "
|
| 523 |
+
"[MiniMax-H3](https://huggingface.co/multimodalart/MiniMax-H3-Pruned) "
|
| 524 |
+
"([inpainting blocks](https://huggingface.co/diffusers-modular/minimax-h3-inpainting), "
|
| 525 |
+
"[turbo LoRA](https://huggingface.co/lightx2v/Minimax-h3-Turbo)) paints the new scene around them - or just "
|
| 526 |
+
"remove the background. **Harmonize** melts the subject's lighting into the scene so they don't look pasted on."
|
|
|
|
| 527 |
)
|
| 528 |
with gr.Row():
|
| 529 |
with gr.Column():
|
| 530 |
clip = gr.Video(label="Clip with a clear subject")
|
| 531 |
remove_bg = gr.Checkbox(value=False, label="Just remove the background (skip generating a new one)")
|
| 532 |
prompt = gr.Textbox(label="New background", placeholder="a sunny tropical beach, palm trees, ocean waves")
|
| 533 |
+
harmonize = gr.Checkbox(value=True, label="Harmonize lighting into the scene",
|
| 534 |
+
info="Blends the subject into the new background (recommended).")
|
|
|
|
|
|
|
| 535 |
harmonize_step = gr.Slider(
|
| 536 |
+
1, 27, value=DEFAULT_HARMONIZE_STEP, step=1, label="Harmonize strength: drop mask at step",
|
| 537 |
+
info="Lower = stronger relight, higher = truer to the original. Try 5 or 6.")
|
|
|
|
| 538 |
with gr.Accordion("Settings", open=False):
|
| 539 |
budget = gr.Dropdown(list(BUDGETS), value=DEFAULT_BUDGET, label="Quality / speed")
|
| 540 |
steps = gr.Slider(4, 28, value=DEFAULT_STEPS, step=1, label="Steps (turbo)")
|