FeilongTang commited on
Commit
14b5be9
Β·
1 Parent(s): b7e9e0a

Remove pipeline flow strip, Quick presets, Hero pills, GOP=global

Browse files

UI cleanup pass:
- Drop the dashed 'Sample β€Ί Score patches β€Ί GOP β€Ί Top-K β€Ί Visualize
β€Ί Pack canvas' flow strip (FLOW_HTML and #ovc-flow CSS).
- Drop the 'Quick presets' card with the Detail / Motion / Balanced
buttons. The 'Load demo video' button in the Input card now plays
the same one-click role.
- Drop the three description chips at the bottom of the hero
('selection Β· heatmap Β· side-by-side', 'gradient + motion saliency',
'codec vs uniform baseline') plus their #ovc-hero .pills / .pill CSS.
- Remove 'Global β€” one budget across the whole video' from the GOP
Radio; default value moves from 'global' to '8'. The underlying
grouped_topk_masks() still accepts 'global' if anyone wires it
programmatically, but it is no longer exposed in the UI.
- Tidy up dead code: PRESETS dict, apply_preset(), preset wiring
loop, mobile @media rules that targeted the removed elements.

Files changed (1) hide show
  1. app.py +1 -106
app.py CHANGED
@@ -757,19 +757,6 @@ def process(
757
  )
758
 
759
 
760
- PRESETS = {
761
- # (saliency_signal, score_log_scale, bitcost_pct, viz_mode)
762
- "detail": ("gradient", False, 99.0, "heatmap"),
763
- "motion": ("frame_diff", False, 95.0, "heatmap"),
764
- "balanced": ("combined", True, 96.0, "sbs"),
765
- }
766
-
767
-
768
- def apply_preset(name: str):
769
- sig, log_, pct, mode = PRESETS[name]
770
- return sig, log_, pct, mode
771
-
772
-
773
  CUSTOM_CSS = """
774
  :root, .gradio-container, .gradio-container.dark {
775
  --ovc-grad: linear-gradient(135deg, #4f46e5 0%, #2563eb 50%, #06b6d4 100%);
@@ -876,17 +863,6 @@ CUSTOM_CSS = """
876
  color: #c7d2fe;
877
  border-color: rgba(99,102,241,0.4);
878
  }
879
- #ovc-hero .pills { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:8px; }
880
- #ovc-hero .pill {
881
- font-size: 0.78rem;
882
- font-weight: 600;
883
- padding: 5px 12px;
884
- border-radius: 999px;
885
- color: #fff;
886
- background: var(--ovc-grad);
887
- opacity: 0.94;
888
- box-shadow: 0 1px 6px rgba(79,70,229,0.25);
889
- }
890
 
891
  /* Cards */
892
  .ovc-card {
@@ -990,31 +966,6 @@ CUSTOM_CSS = """
990
  /* Tighter spacing for sliders inside cards */
991
  .ovc-card .gradio-slider { margin-bottom: 4px !important; }
992
 
993
- /* Pipeline mini-flow strip */
994
- #ovc-flow {
995
- display: flex; flex-wrap: wrap; gap: 6px;
996
- align-items: center; justify-content: center;
997
- padding: 14px 16px; margin-bottom: 18px;
998
- border-radius: 14px;
999
- border: 1px dashed rgba(99,102,241,0.28);
1000
- background: linear-gradient(180deg, rgba(99,102,241,0.04), transparent);
1001
- }
1002
- #ovc-flow .step {
1003
- display: inline-flex; align-items: center; gap: 6px;
1004
- font-size: 0.83rem; font-weight: 600;
1005
- color: #475569;
1006
- padding: 6px 12px;
1007
- background: var(--background-fill-primary);
1008
- border: 1px solid rgba(148,163,184,0.30);
1009
- border-radius: 999px;
1010
- box-shadow: 0 1px 2px rgba(15,23,42,0.04);
1011
- }
1012
- #ovc-flow .step .dot {
1013
- width: 7px; height: 7px; border-radius: 50%;
1014
- background: var(--ovc-grad);
1015
- }
1016
- #ovc-flow .arrow { color: #94a3b8; font-size: 0.95rem; user-select: none; }
1017
-
1018
  /* Tame Gradio's dark default placeholders inside our cards: blanket-override
1019
  any background on the inner wrappers, then paint a brand-tinted gradient on
1020
  the canonical containers. This lights up the empty Video/Image/Plot zones
@@ -1115,14 +1066,6 @@ CUSTOM_CSS = """
1115
  #ovc-hero .by-line { font-size: 0.72rem; padding: 2px 9px; }
1116
  .ovc-links { gap: 6px; margin-top: 10px; }
1117
  .ovc-links a { font-size: 0.78rem; padding: 5px 10px; }
1118
- #ovc-hero .pills { gap: 5px; }
1119
- #ovc-hero .pill { font-size: 0.72rem; padding: 4px 9px; }
1120
-
1121
- /* Pipeline flow: tight wrap, drop arrows */
1122
- #ovc-flow { padding: 10px 12px; gap: 5px; margin-bottom: 12px; }
1123
- #ovc-flow .step { font-size: 0.74rem; padding: 4px 10px; }
1124
- #ovc-flow .arrow { display: none; }
1125
-
1126
  /* Cards tighter */
1127
  .ovc-card { padding: 12px 14px !important; border-radius: 14px !important; }
1128
  .ovc-card h3 { font-size: 0.70rem !important; margin-bottom: 8px !important; }
@@ -1146,7 +1089,6 @@ CUSTOM_CSS = """
1146
  #ovc-hero p.tagline { font-size: 0.9rem; }
1147
  /* Put each link on a row of two (browsers will pack 2 per row at this size) */
1148
  .ovc-links a { font-size: 0.74rem; padding: 4px 9px; }
1149
- #ovc-flow .step { font-size: 0.70rem; padding: 3px 8px; }
1150
  #ovc-run button { height: 46px !important; font-size: 0.94rem !important; }
1151
  }
1152
  """
@@ -1179,11 +1121,6 @@ HERO_HTML = """
1179
  <a href="docs/model_card.md" target="_blank" rel="noopener">πŸ“‹&nbsp;Model Card</a>
1180
  <a href="docs/data_card.md" target="_blank" rel="noopener">πŸ“Š&nbsp;Data Card</a>
1181
  </div>
1182
- <div class="pills">
1183
- <span class="pill">selection Β· heatmap Β· side-by-side</span>
1184
- <span class="pill">gradient + motion saliency</span>
1185
- <span class="pill">codec vs uniform baseline</span>
1186
- </div>
1187
  </div>
1188
  """
1189
 
@@ -1214,27 +1151,10 @@ SIGNAL_CHOICES = [
1214
  ]
1215
 
1216
 
1217
- FLOW_HTML = """
1218
- <div id="ovc-flow">
1219
- <span class="step"><span class="dot"></span>Sample</span>
1220
- <span class="arrow">β€Ί</span>
1221
- <span class="step"><span class="dot"></span>Score patches</span>
1222
- <span class="arrow">β€Ί</span>
1223
- <span class="step"><span class="dot"></span>GOP grouping</span>
1224
- <span class="arrow">β€Ί</span>
1225
- <span class="step"><span class="dot"></span>Top-K select</span>
1226
- <span class="arrow">β€Ί</span>
1227
- <span class="step"><span class="dot"></span>Visualize</span>
1228
- <span class="arrow">β€Ί</span>
1229
- <span class="step"><span class="dot"></span>Pack canvas</span>
1230
- </div>
1231
- """
1232
-
1233
 
1234
 
1235
  with gr.Blocks(**_BLOCK_KW) as demo:
1236
  gr.HTML(HERO_HTML)
1237
- gr.HTML(FLOW_HTML)
1238
 
1239
  with gr.Row(equal_height=False, elem_classes="ovc-main"):
1240
  # ─── Controls (narrow column) ────────────────────────────────────
@@ -1270,13 +1190,12 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1270
  )
1271
  gop = gr.Radio(
1272
  [
1273
- ("Global β€” one budget across the whole video", "global"),
1274
  ("GOP = 4 β€” fixed 4-frame groups", "4"),
1275
  ("GOP = 8 β€” fixed 8-frame groups", "8"),
1276
  ("GOP = 16 β€” fixed 16-frame groups", "16"),
1277
  ("Dynamic β€” adaptive groups by saliency energy", "dynamic"),
1278
  ],
1279
- value="global",
1280
  label="GOP (group of pictures)",
1281
  info="Splits sampled frames into groups; the patch budget "
1282
  "is allocated equally across groups, top-K within "
@@ -1284,18 +1203,6 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1284
  "grouping (equal-energy groups).",
1285
  )
1286
 
1287
- with gr.Group(elem_classes="ovc-card"):
1288
- gr.Markdown("### Quick presets")
1289
- with gr.Row(elem_classes="ovc-preset"):
1290
- btn_detail = gr.Button("Detail", size="sm")
1291
- btn_motion = gr.Button("Motion", size="sm")
1292
- btn_balanced = gr.Button("Balanced", size="sm")
1293
- gr.Markdown(
1294
- "<small><b>Detail</b>: gradient Β· pct=99 Β· heatmap &nbsp;|&nbsp; "
1295
- "<b>Motion</b>: frame_diff Β· pct=95 Β· heatmap &nbsp;|&nbsp; "
1296
- "<b>Balanced</b>: combined Β· log Β· pct=96 Β· sbs</small>"
1297
- )
1298
-
1299
  with gr.Accordion("Time window", open=False):
1300
  with gr.Row():
1301
  start_sec = gr.Number(value=0.0, precision=2, label="Start (s)")
@@ -1385,18 +1292,6 @@ with gr.Blocks(**_BLOCK_KW) as demo:
1385
  '</div>'
1386
  )
1387
 
1388
- # Preset wiring: each updates 4 controls atomically.
1389
- for btn, key in [
1390
- (btn_detail, "detail"),
1391
- (btn_motion, "motion"),
1392
- (btn_balanced, "balanced"),
1393
- ]:
1394
- btn.click(
1395
- lambda k=key: apply_preset(k),
1396
- inputs=None,
1397
- outputs=[saliency_signal, score_log_scale, bitcost_pct, viz_mode],
1398
- )
1399
-
1400
  run_btn.click(
1401
  process,
1402
  inputs=[
 
757
  )
758
 
759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  CUSTOM_CSS = """
761
  :root, .gradio-container, .gradio-container.dark {
762
  --ovc-grad: linear-gradient(135deg, #4f46e5 0%, #2563eb 50%, #06b6d4 100%);
 
863
  color: #c7d2fe;
864
  border-color: rgba(99,102,241,0.4);
865
  }
 
 
 
 
 
 
 
 
 
 
 
866
 
867
  /* Cards */
868
  .ovc-card {
 
966
  /* Tighter spacing for sliders inside cards */
967
  .ovc-card .gradio-slider { margin-bottom: 4px !important; }
968
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
969
  /* Tame Gradio's dark default placeholders inside our cards: blanket-override
970
  any background on the inner wrappers, then paint a brand-tinted gradient on
971
  the canonical containers. This lights up the empty Video/Image/Plot zones
 
1066
  #ovc-hero .by-line { font-size: 0.72rem; padding: 2px 9px; }
1067
  .ovc-links { gap: 6px; margin-top: 10px; }
1068
  .ovc-links a { font-size: 0.78rem; padding: 5px 10px; }
 
 
 
 
 
 
 
 
1069
  /* Cards tighter */
1070
  .ovc-card { padding: 12px 14px !important; border-radius: 14px !important; }
1071
  .ovc-card h3 { font-size: 0.70rem !important; margin-bottom: 8px !important; }
 
1089
  #ovc-hero p.tagline { font-size: 0.9rem; }
1090
  /* Put each link on a row of two (browsers will pack 2 per row at this size) */
1091
  .ovc-links a { font-size: 0.74rem; padding: 4px 9px; }
 
1092
  #ovc-run button { height: 46px !important; font-size: 0.94rem !important; }
1093
  }
1094
  """
 
1121
  <a href="docs/model_card.md" target="_blank" rel="noopener">πŸ“‹&nbsp;Model Card</a>
1122
  <a href="docs/data_card.md" target="_blank" rel="noopener">πŸ“Š&nbsp;Data Card</a>
1123
  </div>
 
 
 
 
 
1124
  </div>
1125
  """
1126
 
 
1151
  ]
1152
 
1153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1154
 
1155
 
1156
  with gr.Blocks(**_BLOCK_KW) as demo:
1157
  gr.HTML(HERO_HTML)
 
1158
 
1159
  with gr.Row(equal_height=False, elem_classes="ovc-main"):
1160
  # ─── Controls (narrow column) ────────────────────────────────────
 
1190
  )
1191
  gop = gr.Radio(
1192
  [
 
1193
  ("GOP = 4 β€” fixed 4-frame groups", "4"),
1194
  ("GOP = 8 β€” fixed 8-frame groups", "8"),
1195
  ("GOP = 16 β€” fixed 16-frame groups", "16"),
1196
  ("Dynamic β€” adaptive groups by saliency energy", "dynamic"),
1197
  ],
1198
+ value="8",
1199
  label="GOP (group of pictures)",
1200
  info="Splits sampled frames into groups; the patch budget "
1201
  "is allocated equally across groups, top-K within "
 
1203
  "grouping (equal-energy groups).",
1204
  )
1205
 
 
 
 
 
 
 
 
 
 
 
 
 
1206
  with gr.Accordion("Time window", open=False):
1207
  with gr.Row():
1208
  start_sec = gr.Number(value=0.0, precision=2, label="Start (s)")
 
1292
  '</div>'
1293
  )
1294
 
 
 
 
 
 
 
 
 
 
 
 
 
1295
  run_btn.click(
1296
  process,
1297
  inputs=[