Jin Zhu commited on
Commit
5bea9ff
·
1 Parent(s): 01664d5

Update app.py

Browse files
Files changed (1) hide show
  1. src/app.py +29 -6
src/app.py CHANGED
@@ -375,12 +375,25 @@ CUSTOM_CSS = """
375
  border: 1px solid #e5e7eb !important;
376
  color: #111827 !important;
377
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  #detect-btn {
379
  background-color: #fdae6b !important;
380
  border-color: white !important;
381
  color: black !important;
382
  font-weight: 600 !important;
383
- height: 4.3rem !important;
384
  font-size: 1.1rem !important;
385
  }
386
  #detect-btn:hover {
@@ -483,7 +496,10 @@ def build_interface() -> gr.Blocks:
483
  show_label=False,
484
  )
485
 
486
- with gr.Row():
 
 
 
487
  with gr.Row(scale=2):
488
  # Level 1 + level 2 of the domain hierarchy, grouped together
489
  # in their own row so they read as one control cluster even
@@ -497,10 +513,15 @@ def build_interface() -> gr.Blocks:
497
  label="Domain",
498
  visible=(DEFAULT_DOMAIN_MODE == "Manual"),
499
  )
500
- detect_btn = gr.Button("🔍 Detect", variant="primary", elem_id="detect-btn", scale=1)
501
  alpha_slider = gr.Slider(
502
  minimum=0.01, maximum=0.2, value=0.05, step=0.005,
503
- label="Significance level (α)", scale=1,
 
 
 
 
 
 
504
  )
505
 
506
  # Hidden by default; `run_detection` toggles it on for the duration of
@@ -516,6 +537,10 @@ def build_interface() -> gr.Blocks:
516
  "— please select a domain manually._"
517
  )
518
 
 
 
 
 
519
  conclusion_md = gr.Markdown(visible=False, latex_delimiters=LATEX_DELIMITERS)
520
 
521
  with gr.Accordion("📋 Interpretation and Suggestions", open=False, visible=False) as interpretation_box:
@@ -523,8 +548,6 @@ def build_interface() -> gr.Blocks:
523
  build_interpretation_text(DEFAULT_DOMAIN_MODE), latex_delimiters=LATEX_DELIMITERS,
524
  )
525
 
526
- elapsed_caption = gr.Markdown(visible=False)
527
-
528
  with gr.Column(visible=False) as feedback_section:
529
  gr.HTML(
530
  '<div style="margin-top: 0.6rem;"><strong>📝 Result Feedback</strong>: '
 
375
  border: 1px solid #e5e7eb !important;
376
  color: #111827 !important;
377
  }
378
+ /* Tighter horizontal spacing between the three boxes in the configuration
379
+ row (domain group / alpha slider / Detect button) — Gradio's default Row
380
+ gap reads as loose once all three are stretched to the same height. */
381
+ #controls-row {
382
+ gap: 0.6rem !important;
383
+ }
384
+ /* #detect-btn's height is set to match the rendered height of its sibling
385
+ boxes (the domain group and the alpha slider — each a label line plus a
386
+ control) in this exact row. Gradio's Row(equal_height=True) (set in
387
+ build_interface) stretches the *wrapper* around the button to match the
388
+ tallest sibling, but the <button> element itself doesn't inherit that via
389
+ percentage/flex sizing, so it still needs an explicit height — 5.625rem
390
+ was measured against this row's actual rendered box height, not guessed. */
391
  #detect-btn {
392
  background-color: #fdae6b !important;
393
  border-color: white !important;
394
  color: black !important;
395
  font-weight: 600 !important;
396
+ height: 5.625rem !important;
397
  font-size: 1.1rem !important;
398
  }
399
  #detect-btn:hover {
 
496
  show_label=False,
497
  )
498
 
499
+ # equal_height=True stretches every direct child (the domain group,
500
+ # the alpha slider, and the Detect button) to the height of the
501
+ # tallest one, so the three read as a single row of matching boxes.
502
+ with gr.Row(elem_id="controls-row", equal_height=True):
503
  with gr.Row(scale=2):
504
  # Level 1 + level 2 of the domain hierarchy, grouped together
505
  # in their own row so they read as one control cluster even
 
513
  label="Domain",
514
  visible=(DEFAULT_DOMAIN_MODE == "Manual"),
515
  )
 
516
  alpha_slider = gr.Slider(
517
  minimum=0.01, maximum=0.2, value=0.05, step=0.005,
518
+ # min_width keeps "Significance level (α)" on one line —
519
+ # without it, a narrow flex-basis wraps the label to two
520
+ # lines and makes this box taller than its siblings.
521
+ label="Significance level (α)", scale=1, min_width=340,
522
+ )
523
+ detect_btn = gr.Button(
524
+ "🔍 Detect", variant="primary", elem_id="detect-btn", scale=1, min_width=120,
525
  )
526
 
527
  # Hidden by default; `run_detection` toggles it on for the duration of
 
537
  "— please select a domain manually._"
538
  )
539
 
540
+ # Sits between the configuration row above and the verdict card
541
+ # below, so "how long that took" reads before "what it found".
542
+ elapsed_caption = gr.Markdown(visible=False)
543
+
544
  conclusion_md = gr.Markdown(visible=False, latex_delimiters=LATEX_DELIMITERS)
545
 
546
  with gr.Accordion("📋 Interpretation and Suggestions", open=False, visible=False) as interpretation_box:
 
548
  build_interpretation_text(DEFAULT_DOMAIN_MODE), latex_delimiters=LATEX_DELIMITERS,
549
  )
550
 
 
 
551
  with gr.Column(visible=False) as feedback_section:
552
  gr.HTML(
553
  '<div style="margin-top: 0.6rem;"><strong>📝 Result Feedback</strong>: '