FeilongTang commited on
Commit
cb21158
Β·
1 Parent(s): fdda169

Widen and rebalance HF layout

Browse files
Files changed (1) hide show
  1. app.py +62 -10
app.py CHANGED
@@ -1018,7 +1018,20 @@ CUSTOM_CSS = """
1018
  --ovc-line-accent-strong: rgba(79,70,229,0.58);
1019
  --ovc-line-cyan: rgba(6,182,212,0.26);
1020
  }
1021
- .gradio-container { max-width: 1320px !important; margin: 0 auto !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
  @keyframes ovc-shift {
1023
  0% { background-position: 0% 50%; }
1024
  50% { background-position: 100% 50%; }
@@ -1121,6 +1134,9 @@ CUSTOM_CSS = """
1121
  border-color: var(--ovc-line-accent) !important;
1122
  box-shadow: 0 6px 22px rgba(15,23,42,0.07);
1123
  }
 
 
 
1124
  /* Primary outputs: subtle accent ring + lift */
1125
  .ovc-card-primary {
1126
  border: 1px solid var(--ovc-ring) !important;
@@ -1208,6 +1224,15 @@ CUSTOM_CSS = """
1208
 
1209
  /* Tighter spacing for sliders inside cards */
1210
  .ovc-card .gradio-slider { margin-bottom: 4px !important; }
 
 
 
 
 
 
 
 
 
1211
 
1212
  /* Tame Gradio's dark default placeholders inside our cards: blanket-override
1213
  any background on the inner wrappers, then paint a brand-tinted gradient on
@@ -1267,6 +1292,25 @@ CUSTOM_CSS = """
1267
  background: linear-gradient(180deg, rgba(99,102,241,0.05), rgba(6,182,212,0.025)) !important;
1268
  border: 1px solid rgba(79,70,229,0.34) !important;
1269
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1270
  .ovc-card .gradio-video, .ovc-card .gradio-image, .ovc-card .gradio-plot {
1271
  border-color: var(--ovc-line) !important;
1272
  background: transparent !important;
@@ -1327,6 +1371,10 @@ CUSTOM_CSS = """
1327
  flex-direction: column !important;
1328
  gap: 12px !important;
1329
  }
 
 
 
 
1330
  .gradio-container .ovc-main > div {
1331
  width: 100% !important;
1332
  min-width: 0 !important;
@@ -1355,6 +1403,10 @@ CUSTOM_CSS = """
1355
 
1356
  /* Outputs: shorter video so it does not dominate the screen */
1357
  .ovc-card video { max-height: 280px !important; }
 
 
 
 
1358
  }
1359
 
1360
  @media (max-width: 480px) {
@@ -1431,10 +1483,10 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1431
 
1432
  with gr.Row(equal_height=False, elem_classes="ovc-main"):
1433
  # ─── Controls (narrow column) ────────────────────────────────────
1434
- with gr.Column(scale=4, min_width=320):
1435
  with gr.Group(elem_classes="ovc-card"):
1436
  gr.Markdown("### Input")
1437
- video_in = gr.Video(label="Video", sources=["upload"], height=240)
1438
  with gr.Row(elem_classes="ovc-preset"):
1439
  btn_demo = gr.Button(
1440
  "Load demo video", size="sm",
@@ -1527,11 +1579,11 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1527
  run_btn = gr.Button("Run pipeline", variant="primary")
1528
 
1529
  # ─── Outputs (wide column) ───────────────────────────────────────
1530
- with gr.Column(scale=6, min_width=420):
1531
  with gr.Group(elem_classes="ovc-card ovc-card-primary"):
1532
  gr.Markdown("### Patch selection visualization")
1533
  vis_out = gr.Video(
1534
- label="", show_label=False, autoplay=True, height=420,
1535
  )
1536
 
1537
  with gr.Group(elem_classes="ovc-card ovc-card-primary"):
@@ -1549,8 +1601,8 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1549
  )
1550
  chart_out = gr.Plot(label="", show_label=False)
1551
 
1552
- with gr.Row():
1553
- with gr.Column(scale=1):
1554
  with gr.Group(elem_classes="ovc-card"):
1555
  gr.Markdown("### Packed canvases (one per GOP group)")
1556
  gr.Markdown(
@@ -1561,11 +1613,11 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1561
  )
1562
  canvas_out = gr.Gallery(
1563
  label="", show_label=False,
1564
- columns=2, rows=2, height=380,
1565
  object_fit="contain",
1566
  preview=True,
1567
  )
1568
- with gr.Column(scale=1):
1569
  with gr.Group(elem_classes="ovc-card"):
1570
  gr.Markdown("### Raw JSON")
1571
  gr.Markdown(
@@ -1575,7 +1627,7 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1575
  )
1576
  with gr.Accordion("Show full JSON", open=False):
1577
  info_out = gr.Code(
1578
- label="", language="json", lines=18,
1579
  )
1580
 
1581
  gr.HTML(
 
1018
  --ovc-line-accent-strong: rgba(79,70,229,0.58);
1019
  --ovc-line-cyan: rgba(6,182,212,0.26);
1020
  }
1021
+ .gradio-container {
1022
+ max-width: 1480px !important;
1023
+ margin: 0 auto !important;
1024
+ padding-left: 10px !important;
1025
+ padding-right: 10px !important;
1026
+ }
1027
+ .ovc-main {
1028
+ gap: 18px !important;
1029
+ align-items: flex-start !important;
1030
+ }
1031
+ .ovc-bottom {
1032
+ gap: 16px !important;
1033
+ align-items: stretch !important;
1034
+ }
1035
  @keyframes ovc-shift {
1036
  0% { background-position: 0% 50%; }
1037
  50% { background-position: 100% 50%; }
 
1134
  border-color: var(--ovc-line-accent) !important;
1135
  box-shadow: 0 6px 22px rgba(15,23,42,0.07);
1136
  }
1137
+ .ovc-card + .ovc-card {
1138
+ margin-top: 2px;
1139
+ }
1140
  /* Primary outputs: subtle accent ring + lift */
1141
  .ovc-card-primary {
1142
  border: 1px solid var(--ovc-ring) !important;
 
1224
 
1225
  /* Tighter spacing for sliders inside cards */
1226
  .ovc-card .gradio-slider { margin-bottom: 4px !important; }
1227
+ .ovc-card .gradio-number,
1228
+ .ovc-card .gradio-radio,
1229
+ .ovc-card .gradio-checkbox,
1230
+ .ovc-card .gradio-code,
1231
+ .ovc-card .gradio-gallery,
1232
+ .ovc-card .gradio-video,
1233
+ .ovc-card .gradio-plot {
1234
+ width: 100% !important;
1235
+ }
1236
 
1237
  /* Tame Gradio's dark default placeholders inside our cards: blanket-override
1238
  any background on the inner wrappers, then paint a brand-tinted gradient on
 
1292
  background: linear-gradient(180deg, rgba(99,102,241,0.05), rgba(6,182,212,0.025)) !important;
1293
  border: 1px solid rgba(79,70,229,0.34) !important;
1294
  }
1295
+ .ovc-card .upload-container,
1296
+ .ovc-card .video-container,
1297
+ .ovc-card .image-container,
1298
+ .ovc-card .plot-container {
1299
+ width: 100% !important;
1300
+ min-width: 0 !important;
1301
+ }
1302
+ .ovc-card .upload-container,
1303
+ .ovc-card [data-testid="file-upload"] {
1304
+ min-height: 220px !important;
1305
+ }
1306
+ .ovc-card .plot-container,
1307
+ .ovc-card [data-testid="plot"] {
1308
+ min-height: 300px !important;
1309
+ }
1310
+ .ovc-card-primary .video-container,
1311
+ .ovc-card [data-testid="video"] {
1312
+ min-height: 260px !important;
1313
+ }
1314
  .ovc-card .gradio-video, .ovc-card .gradio-image, .ovc-card .gradio-plot {
1315
  border-color: var(--ovc-line) !important;
1316
  background: transparent !important;
 
1371
  flex-direction: column !important;
1372
  gap: 12px !important;
1373
  }
1374
+ .gradio-container .ovc-bottom {
1375
+ flex-direction: column !important;
1376
+ gap: 12px !important;
1377
+ }
1378
  .gradio-container .ovc-main > div {
1379
  width: 100% !important;
1380
  min-width: 0 !important;
 
1403
 
1404
  /* Outputs: shorter video so it does not dominate the screen */
1405
  .ovc-card video { max-height: 280px !important; }
1406
+ .ovc-card .upload-container,
1407
+ .ovc-card [data-testid="file-upload"] {
1408
+ min-height: 180px !important;
1409
+ }
1410
  }
1411
 
1412
  @media (max-width: 480px) {
 
1483
 
1484
  with gr.Row(equal_height=False, elem_classes="ovc-main"):
1485
  # ─── Controls (narrow column) ────────────────────────────────────
1486
+ with gr.Column(scale=4, min_width=360):
1487
  with gr.Group(elem_classes="ovc-card"):
1488
  gr.Markdown("### Input")
1489
+ video_in = gr.Video(label="Video", sources=["upload"], height=260)
1490
  with gr.Row(elem_classes="ovc-preset"):
1491
  btn_demo = gr.Button(
1492
  "Load demo video", size="sm",
 
1579
  run_btn = gr.Button("Run pipeline", variant="primary")
1580
 
1581
  # ─── Outputs (wide column) ───────────────────────────────────────
1582
+ with gr.Column(scale=7, min_width=560):
1583
  with gr.Group(elem_classes="ovc-card ovc-card-primary"):
1584
  gr.Markdown("### Patch selection visualization")
1585
  vis_out = gr.Video(
1586
+ label="", show_label=False, autoplay=True, height=460,
1587
  )
1588
 
1589
  with gr.Group(elem_classes="ovc-card ovc-card-primary"):
 
1601
  )
1602
  chart_out = gr.Plot(label="", show_label=False)
1603
 
1604
+ with gr.Row(equal_height=False, elem_classes="ovc-bottom"):
1605
+ with gr.Column(scale=7, min_width=420):
1606
  with gr.Group(elem_classes="ovc-card"):
1607
  gr.Markdown("### Packed canvases (one per GOP group)")
1608
  gr.Markdown(
 
1613
  )
1614
  canvas_out = gr.Gallery(
1615
  label="", show_label=False,
1616
+ columns=2, rows=2, height=420,
1617
  object_fit="contain",
1618
  preview=True,
1619
  )
1620
+ with gr.Column(scale=5, min_width=340):
1621
  with gr.Group(elem_classes="ovc-card"):
1622
  gr.Markdown("### Raw JSON")
1623
  gr.Markdown(
 
1627
  )
1628
  with gr.Accordion("Show full JSON", open=False):
1629
  info_out = gr.Code(
1630
+ label="", language="json", lines=22,
1631
  )
1632
 
1633
  gr.HTML(