studyOverflow commited on
Commit
92ddd15
·
verified ·
1 Parent(s): 207b44d

fix: remove MBench-V tabs, fix white-on-white text in aux info

Browse files
Files changed (1) hide show
  1. app.py +21 -88
app.py CHANGED
@@ -228,8 +228,12 @@ def _render_mbench_a_aux(task: dict) -> str:
228
  """Render auxiliary HTML info based on task subset."""
229
  subset = task["subset"]
230
 
 
 
 
 
 
231
  if subset == "object":
232
- # Show mask overlay image from HF
233
  sample_id = task["sample_id"]
234
  gt_cat = MBENCH_A_GT_CATEGORY_MAP[subset]
235
  first_frame_url = hf_hub_url(
@@ -238,9 +242,9 @@ def _render_mbench_a_aux(task: dict) -> str:
238
  repo_type="dataset",
239
  )
240
  return (
241
- f'<div style="background:#f8f9fa;padding:12px;border-radius:8px;margin-bottom:12px">'
242
- f'<p style="margin:0 0 8px"><b>🎯 请关注画面中被标注(高亮)的物体</b></p>'
243
- f'<img src="{first_frame_url}" style="max-width:100%;max-height:250px;border-radius:4px">'
244
  f'</div>'
245
  )
246
 
@@ -248,35 +252,34 @@ def _render_mbench_a_aux(task: dict) -> str:
248
  caption = task.get("caption", "(无描述)")
249
  motion = task.get("camera_motion", "left_then_right")
250
  motion_desc = task.get("camera_motion_description", motion)
251
- # Camera GIF - use HF asset URL
252
  gif_url = _mbench_a_asset_hf_url(f"camera_diagrams/{motion}.gif")
253
  return (
254
- f'<div style="background:#f8f9fa;padding:12px;border-radius:8px;margin-bottom:12px">'
255
  f'<div style="display:flex;gap:16px;flex-wrap:wrap">'
256
  f'<div style="flex:0 0 200px">'
257
- f'<p style="margin:0 0 4px"><b>🎬 预期相机运动</b></p>'
258
- f'<p style="margin:0 0 8px;color:#555">{motion_desc}</p>'
259
- f'<img src="{gif_url}" style="width:180px;border-radius:4px;border:1px solid #ddd">'
260
  f'</div>'
261
  f'<div style="flex:1;min-width:250px">'
262
- f'<p style="margin:0 0 4px"><b>📝 场景描述</b></p>'
263
- f'<p style="margin:0;color:#333;font-size:14px;line-height:1.5">{caption}</p>'
264
  f'</div>'
265
  f'</div></div>'
266
  )
267
 
268
  elif subset == "human":
269
  return (
270
- '<div style="background:#f8f9fa;padding:12px;border-radius:8px;margin-bottom:12px">'
271
- '<p style="margin:0"><b>👤 请关注视频中的人物</b>:观察人物离开画面再回来后,面部和外观是否保持一致。</p>'
272
- '</div>'
273
  )
274
 
275
  else: # environment
276
  return (
277
- '<div style="background:#f8f9fa;padding:12px;border-radius:8px;margin-bottom:12px">'
278
- '<p style="margin:0"><b>🏞️ 请关注整体场景</b>:观察相机转回来后,场景的布局、风格、光照是否保持一致。</p>'
279
- '</div>'
280
  )
281
 
282
  # ---------------------------------------------------------------------------
@@ -760,77 +763,7 @@ with gr.Blocks(title="MBench 标注", theme=gr.themes.Soft(), css=CUSTOM_CSS) as
760
  gr.Markdown("# 🎬 MBench 视频标注平台")
761
 
762
  with gr.Tabs():
763
- # ═══════════════ Tab 1: 单视频二值标注 (MBench-V) ═══════════════
764
- with gr.Tab("单视频标注 (Memory Issue)"):
765
- gr.Markdown("判断该视频是否出现了**记忆问题**(人物/物体离开后回来变了样、场景前后不一致等)。")
766
- b_stats = gr.Markdown("")
767
- b_state = gr.State({})
768
- with gr.Row():
769
- b_name = gr.Textbox(label="标注员名字", placeholder="例如: alice", scale=4)
770
- b_login = gr.Button("开始", variant="primary", scale=1)
771
- b_status = gr.Markdown("")
772
- with gr.Row():
773
- with gr.Column(scale=3):
774
- b_video = gr.HTML("<p>请先登录。</p>")
775
- with gr.Column(scale=2):
776
- b_prompt = gr.Textbox(label="Prompt(5 段)", lines=14, interactive=False, elem_id="prompt_box")
777
- b_meta = gr.Markdown("")
778
- with gr.Row():
779
- b_verdict = gr.Radio(["否", "是"], value="否", label="是否出现记忆问题?")
780
- b_note = gr.Textbox(label="备注(可选)", lines=1)
781
- with gr.Row():
782
- b_submit = gr.Button("✅ 提交并下一条", variant="primary")
783
- b_skip = gr.Button("⏭️ 跳过")
784
- b_login_outs = [b_state, b_video, b_meta, b_prompt, b_status, b_stats]
785
- b_step_outs = [b_state, b_video, b_meta, b_prompt, b_verdict, b_note, b_status, b_stats]
786
- b_login.click(binary_start, [b_name, b_state], b_login_outs)
787
- b_name.submit(binary_start, [b_name, b_state], b_login_outs)
788
- b_submit.click(binary_submit, [b_state, b_verdict, b_note], b_step_outs)
789
- b_skip.click(binary_skip, [b_state], b_step_outs)
790
-
791
- # ═══════════════ Tab 2: MBench-V Pairwise ═══════════════
792
- with gr.Tab("MBench-V Pairwise"):
793
- gr.Markdown(
794
- "同一 Prompt 下**两个模型的视频并排**,选择哪个在指定维度上更好。\n\n"
795
- "视频 A/B 的模型身份已匿名随机分配。"
796
- )
797
- p_stats = gr.Markdown("")
798
- p_state = gr.State({})
799
- with gr.Row():
800
- p_name = gr.Textbox(label="标注员名字", placeholder="例如: bob", scale=3)
801
- p_dim = gr.Dropdown(
802
- choices=[(dl, dk) for dk, dl, _ in PAIRWISE_DIMENSIONS],
803
- value=PAIRWISE_DIMENSIONS[0][0],
804
- label="评测维度", scale=2,
805
- )
806
- p_login = gr.Button("开始", variant="primary", scale=1)
807
- p_status = gr.Markdown("")
808
- with gr.Row(equal_height=True):
809
- with gr.Column(scale=1, min_width=360):
810
- gr.Markdown("### 视频 A")
811
- p_video_a = gr.HTML("<p>请先登录。</p>")
812
- with gr.Column(scale=1, min_width=360):
813
- gr.Markdown("### 视频 B")
814
- p_video_b = gr.HTML("<p>请先登录。</p>")
815
- with gr.Row():
816
- with gr.Column(scale=3):
817
- p_meta = gr.Markdown("")
818
- with gr.Column(scale=2):
819
- p_prompt = gr.Textbox(label="Prompt", lines=10, interactive=False)
820
- with gr.Row():
821
- p_verdict = gr.Radio(["左边更好", "差不多", "右边更好"], value="差不多", label="哪个视频更好?")
822
- p_note = gr.Textbox(label="备注(可选)", lines=1)
823
- with gr.Row():
824
- p_submit = gr.Button("✅ 提交并下一对", variant="primary")
825
- p_skip = gr.Button("⏭️ 跳过")
826
- p_login_outs = [p_state, p_video_a, p_video_b, p_meta, p_prompt, p_status, p_stats]
827
- p_step_outs = [p_state, p_video_a, p_video_b, p_meta, p_prompt, p_status, p_stats]
828
- p_login.click(pairwise_start, [p_name, p_dim, p_state], p_login_outs)
829
- p_name.submit(pairwise_start, [p_name, p_dim, p_state], p_login_outs)
830
- p_submit.click(pairwise_submit, [p_state, p_verdict, p_note], p_step_outs)
831
- p_skip.click(pairwise_skip, [p_state], p_step_outs)
832
-
833
- # ═══════════════ Tab 3: MBench-A Pairwise ═══════════════
834
  with gr.Tab("MBench-A 对比 (World Models)"):
835
  gr.Markdown(
836
  "## 🌍 MBench-A — 世界模型记忆能力评测\n\n"
 
228
  """Render auxiliary HTML info based on task subset."""
229
  subset = task["subset"]
230
 
231
+ # Shared style: visible on both light and dark themes
232
+ box = 'style="background:#e8edf2;color:#1a1a1a;padding:12px;border-radius:8px;margin-bottom:12px;border:1px solid #c0c8d0"'
233
+ label_style = 'style="margin:0 0 4px;color:#1a1a1a"'
234
+ text_style = 'style="margin:0;color:#2a2a2a;font-size:14px;line-height:1.5"'
235
+
236
  if subset == "object":
 
237
  sample_id = task["sample_id"]
238
  gt_cat = MBENCH_A_GT_CATEGORY_MAP[subset]
239
  first_frame_url = hf_hub_url(
 
242
  repo_type="dataset",
243
  )
244
  return (
245
+ f'<div {box}>'
246
+ f'<p {label_style}><b>🎯 请关注画面中被标注(高亮)的物体</b></p>'
247
+ f'<img src="{first_frame_url}" style="max-width:100%;max-height:250px;border-radius:4px;margin-top:8px">'
248
  f'</div>'
249
  )
250
 
 
252
  caption = task.get("caption", "(无描述)")
253
  motion = task.get("camera_motion", "left_then_right")
254
  motion_desc = task.get("camera_motion_description", motion)
 
255
  gif_url = _mbench_a_asset_hf_url(f"camera_diagrams/{motion}.gif")
256
  return (
257
+ f'<div {box}>'
258
  f'<div style="display:flex;gap:16px;flex-wrap:wrap">'
259
  f'<div style="flex:0 0 200px">'
260
+ f'<p {label_style}><b>🎬 预期相机运动</b></p>'
261
+ f'<p style="margin:0 0 8px;color:#2a2a2a">{motion_desc}</p>'
262
+ f'<img src="{gif_url}" style="width:180px;border-radius:4px;border:1px solid #aaa">'
263
  f'</div>'
264
  f'<div style="flex:1;min-width:250px">'
265
+ f'<p {label_style}><b>📝 场景描述</b></p>'
266
+ f'<p {text_style}>{caption}</p>'
267
  f'</div>'
268
  f'</div></div>'
269
  )
270
 
271
  elif subset == "human":
272
  return (
273
+ f'<div {box}>'
274
+ f'<p {text_style}><b>👤 请关注视频中的人物</b>:观察人物离开画面再回来后,面部和外观是否保持一致。</p>'
275
+ f'</div>'
276
  )
277
 
278
  else: # environment
279
  return (
280
+ f'<div {box}>'
281
+ f'<p {text_style}><b>🏞️ 请关注整体场景</b>:观察相机转回来后,场景的布局、风格、光照是否保持一致。</p>'
282
+ f'</div>'
283
  )
284
 
285
  # ---------------------------------------------------------------------------
 
763
  gr.Markdown("# 🎬 MBench 视频标注平台")
764
 
765
  with gr.Tabs():
766
+ # ═══════════════ MBench-A Pairwise ═══════════════
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
767
  with gr.Tab("MBench-A 对比 (World Models)"):
768
  gr.Markdown(
769
  "## 🌍 MBench-A — 世界模型记忆能力评测\n\n"