Spaces:
Sleeping
Sleeping
audio folded into single prompt; inpaint example None->placeholder mask
Browse files
app.py
CHANGED
|
@@ -92,7 +92,7 @@ def _duration(*args, **kwargs):
|
|
| 92 |
|
| 93 |
|
| 94 |
@spaces.GPU(duration=_duration)
|
| 95 |
-
def outpaint(video, canvas_key, prompt,
|
| 96 |
progress=gr.Progress(track_tqdm=True)):
|
| 97 |
if video is None:
|
| 98 |
raise gr.Error("Please upload a video.")
|
|
@@ -128,8 +128,6 @@ def outpaint(video, canvas_key, prompt, audio, num_frames, seed, randomize,
|
|
| 128 |
|
| 129 |
desc = prompt.strip() or "the scene continues naturally beyond the original frame, consistent style and lighting"
|
| 130 |
full_prompt = f"{desc}; seamlessly extend the scene into the empty margins, matching the existing content."
|
| 131 |
-
if audio.strip():
|
| 132 |
-
full_prompt += f" Audio: {audio.strip()}."
|
| 133 |
|
| 134 |
def _cb(p, i, t, kw):
|
| 135 |
progress((i + 1) / NUM_STEPS, desc=f"Outpainting — step {i + 1}/{NUM_STEPS}")
|
|
@@ -174,9 +172,8 @@ with gr.Blocks(title="LTX-2.3 Video Outpaint") as demo:
|
|
| 174 |
with gr.Column():
|
| 175 |
video_in = gr.Video(label="Input video")
|
| 176 |
canvas_key = gr.Dropdown(list(CANVASES), value="Landscape 16:9 (768×448)", label="Target frame / aspect")
|
| 177 |
-
prompt = gr.Textbox(label="What's beyond the edges (optional)", lines=
|
| 178 |
-
placeholder="more of the same forest extending left and right, soft dappled light")
|
| 179 |
-
audio = gr.Textbox(label="Sound / audio (optional)", lines=1, placeholder="forest ambience, birdsong")
|
| 180 |
with gr.Accordion("Settings", open=False):
|
| 181 |
num_frames = gr.Dropdown(FRAME_CHOICES, value=73, label="Frames (24fps)")
|
| 182 |
randomize = gr.Checkbox(True, label="Randomize seed")
|
|
@@ -186,17 +183,17 @@ with gr.Blocks(title="LTX-2.3 Video Outpaint") as demo:
|
|
| 186 |
video_out = gr.Video(label="Outpainted result")
|
| 187 |
used_seed = gr.Number(label="Seed used", interactive=False)
|
| 188 |
|
| 189 |
-
run.click(outpaint, inputs=[video_in, canvas_key, prompt,
|
| 190 |
outputs=[video_out, used_seed])
|
| 191 |
|
| 192 |
gr.Examples(
|
| 193 |
examples=[
|
| 194 |
["examples/portrait_clip.mp4", "Landscape 16:9 (768×448)",
|
| 195 |
-
"the scene continues to the left and right,
|
| 196 |
["examples/landscape_clip.mp4", "Cinemascope 2.39:1 (768×320)",
|
| 197 |
-
"the vista extends wider on both sides, matching horizon and sky
|
| 198 |
],
|
| 199 |
-
inputs=[video_in, canvas_key, prompt,
|
| 200 |
outputs=[video_out, used_seed], fn=outpaint, cache_examples=True, cache_mode="lazy",
|
| 201 |
)
|
| 202 |
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
@spaces.GPU(duration=_duration)
|
| 95 |
+
def outpaint(video, canvas_key, prompt, num_frames, seed, randomize,
|
| 96 |
progress=gr.Progress(track_tqdm=True)):
|
| 97 |
if video is None:
|
| 98 |
raise gr.Error("Please upload a video.")
|
|
|
|
| 128 |
|
| 129 |
desc = prompt.strip() or "the scene continues naturally beyond the original frame, consistent style and lighting"
|
| 130 |
full_prompt = f"{desc}; seamlessly extend the scene into the empty margins, matching the existing content."
|
|
|
|
|
|
|
| 131 |
|
| 132 |
def _cb(p, i, t, kw):
|
| 133 |
progress((i + 1) / NUM_STEPS, desc=f"Outpainting — step {i + 1}/{NUM_STEPS}")
|
|
|
|
| 172 |
with gr.Column():
|
| 173 |
video_in = gr.Video(label="Input video")
|
| 174 |
canvas_key = gr.Dropdown(list(CANVASES), value="Landscape 16:9 (768×448)", label="Target frame / aspect")
|
| 175 |
+
prompt = gr.Textbox(label="What's beyond the edges, plus any sounds (optional)", lines=3,
|
| 176 |
+
placeholder="more of the same forest extending left and right, soft dappled light; forest ambience and birdsong")
|
|
|
|
| 177 |
with gr.Accordion("Settings", open=False):
|
| 178 |
num_frames = gr.Dropdown(FRAME_CHOICES, value=73, label="Frames (24fps)")
|
| 179 |
randomize = gr.Checkbox(True, label="Randomize seed")
|
|
|
|
| 183 |
video_out = gr.Video(label="Outpainted result")
|
| 184 |
used_seed = gr.Number(label="Seed used", interactive=False)
|
| 185 |
|
| 186 |
+
run.click(outpaint, inputs=[video_in, canvas_key, prompt, num_frames, seed, randomize],
|
| 187 |
outputs=[video_out, used_seed])
|
| 188 |
|
| 189 |
gr.Examples(
|
| 190 |
examples=[
|
| 191 |
["examples/portrait_clip.mp4", "Landscape 16:9 (768×448)",
|
| 192 |
+
"the ocean scene continues to the left and right, matching water, waves and sky; ocean ambience, waves and wind", 73, 42, False],
|
| 193 |
["examples/landscape_clip.mp4", "Cinemascope 2.39:1 (768×320)",
|
| 194 |
+
"the misty mountain vista extends wider on both sides, matching horizon and sky; gentle wind over water", 73, 42, False],
|
| 195 |
],
|
| 196 |
+
inputs=[video_in, canvas_key, prompt, num_frames, seed, randomize],
|
| 197 |
outputs=[video_out, used_seed], fn=outpaint, cache_examples=True, cache_mode="lazy",
|
| 198 |
)
|
| 199 |
|