Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,39 +113,45 @@ def stitch_all(vid12, vid23):
|
|
| 113 |
return None
|
| 114 |
return concat_videos(vid12, vid23)
|
| 115 |
|
| 116 |
-
#
|
| 117 |
CSS = """
|
| 118 |
.gradio-container { padding: 24px; }
|
|
|
|
|
|
|
| 119 |
"""
|
| 120 |
|
| 121 |
-
with gr.Blocks(css=CSS, title="Stitch β
|
| 122 |
-
gr.Markdown("## Stitch β Upload 3 images
|
| 123 |
|
| 124 |
-
#
|
| 125 |
-
with gr.Row():
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
|
|
|
| 133 |
with gr.Row():
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
with gr.Column():
|
| 144 |
-
vid12 = gr.Video(label="Video (1β2)")
|
| 145 |
-
vid23 = gr.Video(label="Video (2β3)")
|
| 146 |
-
vid_all = gr.Video(label="Final Combined Video")
|
| 147 |
-
|
| 148 |
-
# Wire
|
| 149 |
btn12.click(stitch_12, inputs=[prompt12, seed, img1, img2], outputs=[vid12])
|
| 150 |
btn23.click(stitch_23, inputs=[prompt23, seed, img2, img3], outputs=[vid23])
|
| 151 |
btn_all.click(stitch_all, inputs=[vid12, vid23], outputs=[vid_all])
|
|
|
|
| 113 |
return None
|
| 114 |
return concat_videos(vid12, vid23)
|
| 115 |
|
| 116 |
+
# ---------- UI ----------
|
| 117 |
CSS = """
|
| 118 |
.gradio-container { padding: 24px; }
|
| 119 |
+
.pill button { border-radius: 999px !important; padding: 10px 18px; }
|
| 120 |
+
.rounded textarea { border-radius: 16px !important; }
|
| 121 |
"""
|
| 122 |
|
| 123 |
+
with gr.Blocks(css=CSS, title="Stitch β vertical flow") as demo:
|
| 124 |
+
gr.Markdown("## Stitch β Upload 3 images (top), then stitch 1β2 and 2β3, then merge.")
|
| 125 |
|
| 126 |
+
# Top row: 1 - 2 - 3 (three columns)
|
| 127 |
+
with gr.Row():
|
| 128 |
+
with gr.Column(scale=1, min_width=280):
|
| 129 |
+
img1 = gr.Image(label="Image 1 upload", type="pil")
|
| 130 |
+
with gr.Column(scale=1, min_width=280):
|
| 131 |
+
img2 = gr.Image(label="Image 2 upload", type="pil")
|
| 132 |
+
with gr.Column(scale=1, min_width=280):
|
| 133 |
+
img3 = gr.Image(label="Image 3 upload", type="pil")
|
| 134 |
+
|
| 135 |
+
# Seed (standalone, not inside the Row above)
|
| 136 |
+
seed = gr.Number(value=0, precision=0, label="Seed (0 = random)")
|
| 137 |
+
|
| 138 |
+
# Stitch 1β2 (prompt+button row, then video below)
|
| 139 |
+
with gr.Row():
|
| 140 |
+
prompt12 = gr.Textbox(placeholder="Prompt for stitching 1β2", lines=2, label="Prompt (1β2)", elem_classes=["rounded"])
|
| 141 |
+
btn12 = gr.Button("Stitch 1β2", elem_classes=["pill"])
|
| 142 |
+
vid12 = gr.Video(label="Video (1β2)", interactive=False)
|
| 143 |
|
| 144 |
+
# Stitch 2β3
|
| 145 |
with gr.Row():
|
| 146 |
+
prompt23 = gr.Textbox(placeholder="Prompt for stitching 2β3", lines=2, label="Prompt (2β3)", elem_classes=["rounded"])
|
| 147 |
+
btn23 = gr.Button("Stitch 2β3", elem_classes=["pill"])
|
| 148 |
+
vid23 = gr.Video(label="Video (2β3)", interactive=False)
|
| 149 |
+
|
| 150 |
+
# Final merge
|
| 151 |
+
btn_all = gr.Button("Stitch All (concatenate 1β2 then 2β3)", elem_classes=["pill"])
|
| 152 |
+
vid_all = gr.Video(label="Final Combined Video", interactive=False)
|
| 153 |
+
|
| 154 |
+
# Wire buttons
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
btn12.click(stitch_12, inputs=[prompt12, seed, img1, img2], outputs=[vid12])
|
| 156 |
btn23.click(stitch_23, inputs=[prompt23, seed, img2, img3], outputs=[vid23])
|
| 157 |
btn_all.click(stitch_all, inputs=[vid12, vid23], outputs=[vid_all])
|