File size: 2,785 Bytes
31e9635
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347cf89
 
 
 
 
 
 
 
31e9635
 
9e18944
 
 
1cbf0c9
9e18944
 
 
 
 
 
 
 
 
 
 
 
 
31e9635
 
 
 
 
 
 
 
347cf89
9e18944
 
 
 
 
 
 
31e9635
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import gradio as gr

def render_column_player():
    with gr.Column(scale=4):
        video_output = gr.Video(
            label="📹 Generated Video Result", 
            autoplay=True, 
            sources=["upload"], 
            buttons=["download", "share"], 
            interactive=True, 
            elem_id="generated-video"
        )
        
        with gr.Row():
            grab_frame_btn = gr.Button("📸 Frame -> Input Image", variant="secondary")
            grab_last_frame_btn = gr.Button("🏁 Frame -> Last Frame", variant="secondary")
            grab_swap_target_btn = gr.Button("👤 Frame -> Swap Target", variant="secondary")
            timestamp_box = gr.Number(value=0, label="Timestamp", visible=True, elem_id="hidden-timestamp")
        
        gpu_report_box = gr.HTML()
        file_output = gr.File(label="📥 Download Video File")

        with gr.Accordion("🖼️ Last Image (Optional End Frame)", open=False):
            last_image_component = gr.Image(
                type="pil", 
                label="Last Image (Optional End Frame)", 
                sources=["upload", "clipboard"],
                height=200
            )

        play_result_video = gr.Checkbox(label="Display Video Preview", value=True, interactive=True)

        merge_queue_state = gr.State(value=[])
        with gr.Accordion("🔗 Standalone Video Merge & Stitcher", open=False):
            with gr.Row():
                append_merge_btn = gr.Button("➕ Append Output Video & Merge", variant="primary")
                clear_merge_btn = gr.Button("🗑️ Clear Queue", variant="stop")

            merge_status_box = gr.HTML("<div style='color: #94a3b8; font-size: 0.85rem; padding: 4px 0;'>Merge Queue: Empty (0 clips)</div>")

            merged_video_output = gr.Video(
                label="🎬 Merged Video Result",
                autoplay=True,
                sources=["upload"],
                buttons=["download"],
                height=220
            )
            merged_file_output = gr.File(label="📥 Download Merged MP4")

    return {
        "video_output": video_output,
        "grab_frame_btn": grab_frame_btn,
        "grab_last_frame_btn": grab_last_frame_btn,
        "grab_swap_target_btn": grab_swap_target_btn,
        "timestamp_box": timestamp_box,
        "gpu_report_box": gpu_report_box,
        "file_output": file_output,
        "last_image_component": last_image_component,
        "play_result_video": play_result_video,
        "merge_queue_state": merge_queue_state,
        "append_merge_btn": append_merge_btn,
        "clear_merge_btn": clear_merge_btn,
        "merge_status_box": merge_status_box,
        "merged_video_output": merged_video_output,
        "merged_file_output": merged_file_output
    }