WitneyWW commited on
Commit
ee87b42
·
1 Parent(s): 1a3b1b1

two-pane layout: video left, questions right with independent scrolling

Browse files
Files changed (1) hide show
  1. app.py +65 -44
app.py CHANGED
@@ -329,6 +329,24 @@ def first_unanswered(annotator):
329
 
330
 
331
  # ---------------------------------------------------------------- app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  with gr.Blocks(title="Object-centric annotation eval") as demo:
333
  idx_state = gr.State(0)
334
  name_state = gr.State("")
@@ -340,49 +358,52 @@ with gr.Blocks(title="Object-centric annotation eval") as demo:
340
 
341
  with gr.Column(visible=False) as main_col:
342
  header = gr.Markdown()
343
- gr.Markdown(
344
- "⏱ **All annotation times are seconds in the full recording.** The current time is the boxed "
345
- "**VIDEO TIME** at the top-right of the video and the white playhead on the bottom time axis "
346
- "(the player's own 0–30 s counter is NOT the annotation time). "
347
- "**Clip overlays:** red box = object near each keyframe · red dot = where the wearer is looking (gaze) · "
348
- "yellow *GAZE ON OBJECT* = the memory claims a gaze dwell · **blue NARRATION** = HD-EPIC annotator text "
349
- "(not audio) with its [start-end] and START/END markers · **purple SPEECH** = words actually spoken in the "
350
- "audio (ASR) · **green SOUND** = sound events · bottom bar = timeline lanes sound / narration / speech / dwell, "
351
- "white ticks = narration start/end, red ticks = keyframes, white line = playhead. "
352
- "**Keyframes:** green = SAM3 mask, red = box, red dot = gaze."
353
- )
354
- with gr.Row():
355
- with gr.Column(scale=5):
356
- video = gr.Video(label="Clip with overlays", autoplay=True, height=600)
357
- gallery = gr.Gallery(label="Keyframes (mask + box)", columns=3, height=260, object_fit="contain")
358
- with gr.Column(scale=5):
359
- ann_md = gr.Markdown()
360
- with gr.Accordion("Cross-check vs original HD-EPIC annotation (auto-generated, for reference)", open=False):
361
- xc_md = gr.Markdown()
362
- with gr.Accordion("How to judge — read this once", open=True):
363
- gr.Markdown(
364
- "- Each question states **one claim** of an auto-generated memory about **one object**. Say whether it matches the video.\n"
365
- "- **Correct** / **Partially correct** (right idea, a place / time / detail is off) / **Incorrect** / **Can't tell**.\n"
366
- "- **Times** = seconds of the full recording → read the boxed **VIDEO TIME** (top-right). Differences under ~1 s are fine.\n"
367
- "- **Places** like “the counter #2”: judge the **kind of place**; ignore the number.\n"
368
- "- **Sound**: 🔊 turn it on (audio is amplified).\n"
369
- "- **Gaze**: the red dot is always shown; the gaze question is only about the **moment right before the hand touches the object**.")
370
- gr.Markdown("## Your judgement")
371
- q_mds, radios = [], []
372
- for key, _ in DIMENSIONS:
373
- q_mds.append(gr.Markdown())
374
- radios.append(gr.Radio(CHOICES, show_label=False, container=False))
375
- gr.Markdown("### Narrations — judge **each one** separately (blue subtitles; compare with **VIDEO TIME**)")
376
- narr_mds, narr_radios = [], []
377
- for k in range(NARR_MAX):
378
- narr_mds.append(gr.Markdown(visible=(k == 0)))
379
- narr_radios.append(gr.Radio(CHOICES, show_label=False, container=False, visible=(k == 0)))
380
- comment = gr.Textbox(label="Comment (optional)", lines=2)
381
- with gr.Row():
382
- prev_btn = gr.Button("◀ Prev")
383
- skip_btn = gr.Button("Skip ▶")
384
- submit_btn = gr.Button("Submit & Next ▶", variant="primary")
385
- msg = gr.Markdown()
 
 
 
386
 
387
  outputs = [idx_state, header, video, gallery, ann_md, xc_md] + q_mds + radios + narr_mds + narr_radios + [comment]
388
 
@@ -425,4 +446,4 @@ if __name__ == "__main__":
425
  ap.add_argument("--host", default="0.0.0.0")
426
  ap.add_argument("--share", action="store_true")
427
  a = ap.parse_args()
428
- demo.launch(server_name=a.host, server_port=a.port, share=a.share, allowed_paths=[str(MEDIA)], show_error=True)
 
329
 
330
 
331
  # ---------------------------------------------------------------- app
332
+ # Side-by-side layout: the video stays put on the left while the questions scroll on the
333
+ # right, so nobody has to scroll away from the clip to answer. Stacks again on narrow screens.
334
+ CSS = """
335
+ #eval-row { align-items: flex-start; flex-wrap: nowrap; }
336
+ #left-pane, #right-pane { max-height: calc(100vh - 70px); overflow-y: auto; flex-wrap: nowrap; }
337
+ /* a column is a flex box: without this its children are squeezed to fit instead of scrolling */
338
+ #left-pane > *, #right-pane > * { flex-shrink: 0; }
339
+ #right-pane { padding-right: 10px; }
340
+ #eval-video video { max-height: 62vh; width: 100%; object-fit: contain; }
341
+ .q-stem { margin-top: 14px !important; margin-bottom: 2px !important; }
342
+ .q-stem p, .q-stem li { font-size: 15px; line-height: 1.35; }
343
+ .q-ans { margin-bottom: 6px !important; }
344
+ @media (max-width: 1000px) {
345
+ #eval-row { flex-wrap: wrap; }
346
+ #left-pane, #right-pane { max-height: none; overflow-y: visible; }
347
+ }
348
+ """
349
+
350
  with gr.Blocks(title="Object-centric annotation eval") as demo:
351
  idx_state = gr.State(0)
352
  name_state = gr.State("")
 
358
 
359
  with gr.Column(visible=False) as main_col:
360
  header = gr.Markdown()
361
+ with gr.Row(elem_id="eval-row"):
362
+ # ---- left: what to look at (stays in view) ----
363
+ with gr.Column(scale=5, elem_id="left-pane"):
364
+ video = gr.Video(show_label=False, autoplay=True, loop=True, elem_id="eval-video")
365
+ gallery = gr.Gallery(label="Keyframes: green = mask, red = box, red dot = gaze", columns=4, rows=1, height=190,
366
+ object_fit="contain")
367
+ with gr.Accordion("Legend — what the overlays mean", open=False):
368
+ gr.Markdown(
369
+ "- **VIDEO TIME** (top-right, boxed) = seconds of the full recording; every annotation time uses it "
370
+ "(the player's own 0–30 s counter does not).\n"
371
+ "- **red box** = the object, near each keyframe · **red dot** = where the wearer is looking.\n"
372
+ "- yellow **GAZE ON OBJECT** = the memory claims a look at the object.\n"
373
+ "- **blue NARRATION** = annotator text (not audio), with [start–end] · **purple SPEECH** = words "
374
+ "actually spoken · **green SOUND** = sound events.\n"
375
+ "- bottom bar = timeline: lanes sound / narration / speech / dwell, white ticks = narration "
376
+ "start/end, red ticks = keyframes, white line = now.")
377
+ # ---- right: the questions (scrolls on its own) ----
378
+ with gr.Column(scale=6, elem_id="right-pane"):
379
+ with gr.Accordion("How to judge — read this once", open=True):
380
+ gr.Markdown(
381
+ "- Each question states **one claim** of an auto-generated memory about **one object**. Say whether it matches the video.\n"
382
+ "- **Correct** / **Partially correct** (right idea, a place / time / detail is off) / **Incorrect** / **Can't tell**.\n"
383
+ "- **Times** = seconds of the full recording → read the boxed **VIDEO TIME** (top-right). Differences under ~1 s are fine.\n"
384
+ "- **Places** like “the counter #2”: judge the **kind of place**; ignore the number.\n"
385
+ "- **Sound**: 🔊 turn it on (audio is amplified).\n"
386
+ "- **Gaze**: the red dot is always shown; the gaze question is only about the **moment right before the hand touches the object**.")
387
+ q_mds, radios = [], []
388
+ for key, _ in DIMENSIONS:
389
+ q_mds.append(gr.Markdown(elem_classes="q-stem"))
390
+ radios.append(gr.Radio(CHOICES, show_label=False, container=False, elem_classes="q-ans"))
391
+ gr.Markdown("### Narrations — judge **each one** separately (blue subtitles; compare with **VIDEO TIME**)")
392
+ narr_mds, narr_radios = [], []
393
+ for k in range(NARR_MAX):
394
+ narr_mds.append(gr.Markdown(visible=(k == 0), elem_classes="q-stem"))
395
+ narr_radios.append(gr.Radio(CHOICES, show_label=False, container=False, visible=(k == 0),
396
+ elem_classes="q-ans"))
397
+ comment = gr.Textbox(label="Comment (optional)", lines=2)
398
+ with gr.Row():
399
+ prev_btn = gr.Button("◀ Prev")
400
+ skip_btn = gr.Button("Skip ▶")
401
+ submit_btn = gr.Button("Submit & Next ▶", variant="primary")
402
+ msg = gr.Markdown()
403
+ with gr.Accordion("Full memory record of this object (reference)", open=False):
404
+ ann_md = gr.Markdown()
405
+ with gr.Accordion("Cross-check vs original HD-EPIC annotation (reference)", open=False):
406
+ xc_md = gr.Markdown()
407
 
408
  outputs = [idx_state, header, video, gallery, ann_md, xc_md] + q_mds + radios + narr_mds + narr_radios + [comment]
409
 
 
446
  ap.add_argument("--host", default="0.0.0.0")
447
  ap.add_argument("--share", action="store_true")
448
  a = ap.parse_args()
449
+ demo.launch(server_name=a.host, server_port=a.port, share=a.share, allowed_paths=[str(MEDIA)], show_error=True, css=CSS)