studyOverflow commited on
Commit
31cfb32
·
verified ·
1 Parent(s): c8e1c40

fix: narrow-screen layout (wrap rows, min_width on columns) to prevent right half from vanishing

Browse files
Files changed (1) hide show
  1. app.py +17 -12
app.py CHANGED
@@ -430,7 +430,12 @@ def skip_and_next(state: dict):
430
  # ---------------------------------------------------------------------------
431
 
432
  CUSTOM_CSS = """
433
- #prompt_box textarea { height: 480px !important; overflow-y: auto !important; }
 
 
 
 
 
434
  """
435
 
436
  with gr.Blocks(title="MBench-V 标注", theme=gr.themes.Soft(),
@@ -439,7 +444,7 @@ with gr.Blocks(title="MBench-V 标注", theme=gr.themes.Soft(),
439
  """
440
  # 🎬 MBench-V 视频标注 —— *该视频是否出现了记忆问题?*
441
 
442
- 请对照右侧的 5 段 Prompt 观看左侧视频,然后选择 **是** 或 **否**。
443
  """
444
  )
445
 
@@ -451,35 +456,35 @@ with gr.Blocks(title="MBench-V 标注", theme=gr.themes.Soft(),
451
  annotator_in = gr.Textbox(
452
  label="标注员名字", placeholder="例如:alice", scale=4, autofocus=True,
453
  )
454
- login_btn = gr.Button("开始", variant="primary", scale=1)
455
 
456
  status_md = gr.Markdown("_尚未开始。_")
457
 
458
- # ========= 上排:视频 Prompt =========
459
  with gr.Row(equal_height=True):
460
- with gr.Column(scale=3):
461
  video = gr.HTML(value=PLACEHOLDER_VIDEO, label="生成的视频")
462
- with gr.Column(scale=2):
463
  prompt_tb = gr.Textbox(
464
  label="生成 Prompt(共 5 段)",
465
- lines=22, max_lines=22,
466
  interactive=False, show_copy_button=True,
467
  elem_id="prompt_box",
468
  )
469
 
470
- # ========= 下排:元信息 选项 =========
471
  with gr.Row():
472
- with gr.Column(scale=3):
473
  meta_md = gr.Markdown("_当前没有加载任务。_")
474
- with gr.Column(scale=2):
475
  verdict = gr.Radio(
476
  choices=["否", "是"], value="否",
477
  label="该视频是否出现了记忆问题?",
478
  )
479
  note = gr.Textbox(label="备注(可选)", lines=2)
480
  with gr.Row():
481
- submit_btn = gr.Button("✅ 提交并下一条", variant="primary")
482
- skip_btn = gr.Button("⏭️ 跳过")
483
 
484
  # ========= Wiring =========
485
  login_outputs = [state, video, meta_md, prompt_tb, status_md, stats_md]
 
430
  # ---------------------------------------------------------------------------
431
 
432
  CUSTOM_CSS = """
433
+ /* Make the prompt textarea scroll inside its fixed height instead of getting
434
+ clipped or hidden on narrow screens. */
435
+ #prompt_box textarea { height: 400px !important; overflow-y: auto !important; }
436
+ /* Ensure Gradio rows wrap instead of overflowing / hiding children when the
437
+ HF Space iframe is narrow (this was making half the UI invisible). */
438
+ .gradio-container .gr-row, .gradio-container .form { flex-wrap: wrap !important; }
439
  """
440
 
441
  with gr.Blocks(title="MBench-V 标注", theme=gr.themes.Soft(),
 
444
  """
445
  # 🎬 MBench-V 视频标注 —— *该视频是否出现了记忆问题?*
446
 
447
+ 请对照视频和 Prompt,然后选择 **是** 或 **否**。
448
  """
449
  )
450
 
 
456
  annotator_in = gr.Textbox(
457
  label="标注员名字", placeholder="例如:alice", scale=4, autofocus=True,
458
  )
459
+ login_btn = gr.Button("开始", variant="primary", scale=1, min_width=100)
460
 
461
  status_md = gr.Markdown("_尚未开始。_")
462
 
463
+ # ========= 上排:视频 | Prompt (横向;窄屏自动折行) =========
464
  with gr.Row(equal_height=True):
465
+ with gr.Column(scale=3, min_width=360):
466
  video = gr.HTML(value=PLACEHOLDER_VIDEO, label="生成的视频")
467
+ with gr.Column(scale=2, min_width=320):
468
  prompt_tb = gr.Textbox(
469
  label="生成 Prompt(共 5 段)",
470
+ lines=18, max_lines=18,
471
  interactive=False, show_copy_button=True,
472
  elem_id="prompt_box",
473
  )
474
 
475
+ # ========= 下排:元信息 | 选项 =========
476
  with gr.Row():
477
+ with gr.Column(scale=3, min_width=320):
478
  meta_md = gr.Markdown("_当前没有加载任务。_")
479
+ with gr.Column(scale=2, min_width=320):
480
  verdict = gr.Radio(
481
  choices=["否", "是"], value="否",
482
  label="该视频是否出现了记忆问题?",
483
  )
484
  note = gr.Textbox(label="备注(可选)", lines=2)
485
  with gr.Row():
486
+ submit_btn = gr.Button("✅ 提交并下一条", variant="primary", min_width=140)
487
+ skip_btn = gr.Button("⏭️ 跳过", min_width=100)
488
 
489
  # ========= Wiring =========
490
  login_outputs = [state, video, meta_md, prompt_tb, status_md, stats_md]