Shalmoni commited on
Commit
0247b0d
Β·
verified Β·
1 Parent(s): e4082dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -26
app.py CHANGED
@@ -113,39 +113,45 @@ def stitch_all(vid12, vid23):
113
  return None
114
  return concat_videos(vid12, vid23)
115
 
116
- # -------- UI --------
117
  CSS = """
118
  .gradio-container { padding: 24px; }
 
 
119
  """
120
 
121
- with gr.Blocks(css=CSS, title="Stitch β€” 3 uploads, 2 stitches") as demo:
122
- gr.Markdown("## Stitch β€” Upload 3 images β†’ Generate 1β†’2, 2β†’3, then combine.")
123
 
124
- # --- Uploads row (side-by-side) ---
125
- with gr.Row():
126
- with gr.Column(scale=1, min_width=280):
127
- img1 = gr.Image(label="Image 1 upload", type="pil")
128
- with gr.Column(scale=1, min_width=280):
129
- img2 = gr.Image(label="Image 2 upload", type="pil")
130
- with gr.Column(scale=1, min_width=280):
131
- img3 = gr.Image(label="Image 3 upload", type="pil")
 
 
 
 
 
 
 
 
 
132
 
 
133
  with gr.Row():
134
- # Prompts + buttons
135
- with gr.Column():
136
- seed = gr.Number(value=0, precision=0, label="Seed (0 = random)")
137
- prompt12 = gr.Textbox(placeholder="Prompt for stitching 1β†’2", lines=2, label="Prompt (1β†’2)")
138
- btn12 = gr.Button("Stitch 1&2")
139
- prompt23 = gr.Textbox(placeholder="Prompt for stitching 2β†’3", lines=2, label="Prompt (2β†’3)")
140
- btn23 = gr.Button("Stitch 2&3")
141
- btn_all = gr.Button("Stitch All (combine 1β†’2 and 2β†’3)")
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])