Spaces:
Running on Zero
Running on Zero
Improve UI layout: fixed video height, align input/output with tabs
Browse files
app.py
CHANGED
|
@@ -250,27 +250,35 @@ with gr.Blocks(title="Game Editing", theme=gr.themes.Soft()) as demo:
|
|
| 250 |
status = gr.Markdown("**Upload 5 G-buffer videos, pick a style, and hit Generate. (0/5 uploaded)**")
|
| 251 |
|
| 252 |
# ── Top row: Input (left) + Output (right), videos aligned ──
|
|
|
|
|
|
|
| 253 |
with gr.Row(equal_height=True):
|
|
|
|
| 254 |
with gr.Column(scale=1):
|
| 255 |
with gr.Tabs():
|
| 256 |
with gr.Tab("Albedo"):
|
| 257 |
-
albedo = gr.Video(label="Albedo video", sources=["upload"])
|
| 258 |
with gr.Tab("Depth"):
|
| 259 |
-
depth = gr.Video(label="Depth video", sources=["upload"])
|
| 260 |
with gr.Tab("Metallic"):
|
| 261 |
-
metallic = gr.Video(label="Metallic video", sources=["upload"])
|
| 262 |
with gr.Tab("Normal"):
|
| 263 |
-
normal = gr.Video(label="Normal video", sources=["upload"])
|
| 264 |
with gr.Tab("Roughness"):
|
| 265 |
-
roughness = gr.Video(label="Roughness video", sources=["upload"])
|
| 266 |
|
|
|
|
| 267 |
all_videos = [albedo, depth, metallic, normal, roughness]
|
| 268 |
for v in all_videos:
|
| 269 |
v.change(update_status, inputs=all_videos, outputs=[status])
|
| 270 |
v.clear(update_status, inputs=all_videos, outputs=[status])
|
| 271 |
|
|
|
|
| 272 |
with gr.Column(scale=1):
|
| 273 |
-
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
# ── Bottom: Settings ──
|
| 276 |
gr.Markdown("### Settings")
|
|
|
|
| 250 |
status = gr.Markdown("**Upload 5 G-buffer videos, pick a style, and hit Generate. (0/5 uploaded)**")
|
| 251 |
|
| 252 |
# ── Top row: Input (left) + Output (right), videos aligned ──
|
| 253 |
+
VIDEO_HEIGHT = 400
|
| 254 |
+
|
| 255 |
with gr.Row(equal_height=True):
|
| 256 |
+
# 左侧 Column
|
| 257 |
with gr.Column(scale=1):
|
| 258 |
with gr.Tabs():
|
| 259 |
with gr.Tab("Albedo"):
|
| 260 |
+
albedo = gr.Video(label="Albedo video", sources=["upload"], height=VIDEO_HEIGHT)
|
| 261 |
with gr.Tab("Depth"):
|
| 262 |
+
depth = gr.Video(label="Depth video", sources=["upload"], height=VIDEO_HEIGHT)
|
| 263 |
with gr.Tab("Metallic"):
|
| 264 |
+
metallic = gr.Video(label="Metallic video", sources=["upload"], height=VIDEO_HEIGHT)
|
| 265 |
with gr.Tab("Normal"):
|
| 266 |
+
normal = gr.Video(label="Normal video", sources=["upload"], height=VIDEO_HEIGHT)
|
| 267 |
with gr.Tab("Roughness"):
|
| 268 |
+
roughness = gr.Video(label="Roughness video", sources=["upload"], height=VIDEO_HEIGHT)
|
| 269 |
|
| 270 |
+
# 事件绑定
|
| 271 |
all_videos = [albedo, depth, metallic, normal, roughness]
|
| 272 |
for v in all_videos:
|
| 273 |
v.change(update_status, inputs=all_videos, outputs=[status])
|
| 274 |
v.clear(update_status, inputs=all_videos, outputs=[status])
|
| 275 |
|
| 276 |
+
# 右侧 Column
|
| 277 |
with gr.Column(scale=1):
|
| 278 |
+
# 💡 核心技巧:右边也套上 Tabs,强制 UI 顶部对齐
|
| 279 |
+
with gr.Tabs():
|
| 280 |
+
with gr.Tab("Result"):
|
| 281 |
+
output_video = gr.Video(label="Generated Video", height=VIDEO_HEIGHT)
|
| 282 |
|
| 283 |
# ── Bottom: Settings ──
|
| 284 |
gr.Markdown("### Settings")
|