Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
#9
by
linoyts
HF Staff
- opened
app.py
CHANGED
@@ -445,9 +445,12 @@ def generate_video(gallery_images, mode, prompt, height, width,
|
|
445 |
|
446 |
control_modes = """
|
447 |
**3 control modes available:**
|
448 |
-
|
449 |
-
|
450 |
-
|
|
|
|
|
|
|
451 |
"""
|
452 |
|
453 |
with gr.Blocks() as demo:
|
@@ -480,9 +483,9 @@ with gr.Blocks() as demo:
|
|
480 |
|
481 |
# Background removal checkbox moved here - right beneath control modes
|
482 |
remove_bg_checkbox = gr.Checkbox(
|
483 |
-
label="Remove Background",
|
484 |
value=False,
|
485 |
-
info="
|
486 |
)
|
487 |
|
488 |
prompt_input = gr.Textbox(label="Prompt", value=MODE_PROMPTS["reference"])
|
@@ -490,7 +493,7 @@ with gr.Blocks() as demo:
|
|
490 |
minimum=round(MIN_FRAMES_MODEL/FIXED_FPS,1),
|
491 |
maximum=round(MAX_FRAMES_MODEL/FIXED_FPS,1),
|
492 |
step=0.1,
|
493 |
-
value=2,
|
494 |
label="Duration (seconds)",
|
495 |
info=f"Clamped to model's {MIN_FRAMES_MODEL}-{MAX_FRAMES_MODEL} frames at {FIXED_FPS}fps."
|
496 |
)
|
@@ -511,9 +514,25 @@ with gr.Blocks() as demo:
|
|
511 |
with gr.Column():
|
512 |
video_output = gr.Video(label="Generated Video", autoplay=True, interactive=False)
|
513 |
|
514 |
-
# Function to update checkbox visibility based on mode
|
515 |
def update_bg_removal_visibility(mode):
|
516 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
518 |
# Update prompt when mode changes
|
519 |
mode_radio.change(
|
|
|
445 |
|
446 |
control_modes = """
|
447 |
**3 control modes available:**
|
448 |
+
|
449 |
+
**Reference** Generate a video incorporating elements from input reference images
|
450 |
+
|
451 |
+
**First - Last Frame** Generate a video using first and last frame conditioning defined by input images
|
452 |
+
|
453 |
+
**Random Transitions** Generate a video with intermediate transitions between multiple input images
|
454 |
"""
|
455 |
|
456 |
with gr.Blocks() as demo:
|
|
|
483 |
|
484 |
# Background removal checkbox moved here - right beneath control modes
|
485 |
remove_bg_checkbox = gr.Checkbox(
|
486 |
+
label="Remove Background (Reference mode only)",
|
487 |
value=False,
|
488 |
+
info="Removes background from input images to prevent unwanted background elements in the generated video"
|
489 |
)
|
490 |
|
491 |
prompt_input = gr.Textbox(label="Prompt", value=MODE_PROMPTS["reference"])
|
|
|
493 |
minimum=round(MIN_FRAMES_MODEL/FIXED_FPS,1),
|
494 |
maximum=round(MAX_FRAMES_MODEL/FIXED_FPS,1),
|
495 |
step=0.1,
|
496 |
+
value=2.8,
|
497 |
label="Duration (seconds)",
|
498 |
info=f"Clamped to model's {MIN_FRAMES_MODEL}-{MAX_FRAMES_MODEL} frames at {FIXED_FPS}fps."
|
499 |
)
|
|
|
514 |
with gr.Column():
|
515 |
video_output = gr.Video(label="Generated Video", autoplay=True, interactive=False)
|
516 |
|
517 |
+
# Function to update checkbox visibility and info based on mode
|
518 |
def update_bg_removal_visibility(mode):
|
519 |
+
# Mode explanations from the markdown
|
520 |
+
mode_explanations = {
|
521 |
+
"reference": "Generate a video incorporating elements from input reference images",
|
522 |
+
"first - last frame": "Generate a video using first and last frame conditioning defined by input images",
|
523 |
+
"random transitions": "Generate a video with intermediate transitions between multiple input images"
|
524 |
+
}
|
525 |
+
|
526 |
+
if mode == "reference":
|
527 |
+
return gr.update(
|
528 |
+
visible=True,
|
529 |
+
info=f"{mode_explanations[mode]}. Remove background to prevent unwanted background elements in the generated video."
|
530 |
+
)
|
531 |
+
else:
|
532 |
+
return gr.update(
|
533 |
+
visible=False,
|
534 |
+
info=mode_explanations.get(mode, "")
|
535 |
+
)
|
536 |
|
537 |
# Update prompt when mode changes
|
538 |
mode_radio.change(
|