Inframat-x commited on
Commit
49373c5
·
verified ·
1 Parent(s): b8e175e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -2
app.py CHANGED
@@ -6,6 +6,7 @@
6
  # - Stable categoricals ("NA"); no over-strict completeness gate
7
  # - Fixed [[PAGE=...]] regex
8
  # - NEW: Lightweight instrumentation (JSONL logs per RAG turn)
 
9
  # ================================================================
10
 
11
  # ---------------------- Runtime flags (HF-safe) ----------------------
@@ -17,7 +18,7 @@ os.environ["TOKENIZERS_PARALLELISM"] = "false"
17
  # ------------------------------- Imports ------------------------------
18
  import re, joblib, warnings, json, traceback, time, uuid, subprocess, sys
19
  from pathlib import Path
20
- from typing import List, Dict, Any
21
 
22
  import numpy as np
23
  import pandas as pd
@@ -849,6 +850,72 @@ input[type="checkbox"], .gr-checkbox, .gr-checkbox > * { pointer-events: auto !i
849
 
850
  /* Predictor output emphasis */
851
  #pred-out .wrap { font-size: 20px; font-weight: 700; color: #ecfdf5; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
  """
853
 
854
  theme = gr.themes.Soft(
@@ -987,7 +1054,8 @@ with gr.Blocks(css=CSS, theme=theme, fill_height=True) as demo:
987
  gr.Markdown("Upload your **gold.csv** and compute metrics against the app logs.")
988
  with gr.Row():
989
  gold_file = gr.File(label="gold.csv", file_types=[".csv"], interactive=True)
990
- k_slider = gr.Slider(3, 12, value=8, step=1, label="k for Hit/Recall/nDCG")
 
991
  with gr.Row():
992
  btn_eval = gr.Button("Compute Metrics", variant="primary")
993
  with gr.Row():
 
6
  # - Stable categoricals ("NA"); no over-strict completeness gate
7
  # - Fixed [[PAGE=...]] regex
8
  # - NEW: Lightweight instrumentation (JSONL logs per RAG turn)
9
+ # - UPDATED UI COLORS: Dark-blue theme for tabs + Evaluate k-slider
10
  # ================================================================
11
 
12
  # ---------------------- Runtime flags (HF-safe) ----------------------
 
18
  # ------------------------------- Imports ------------------------------
19
  import re, joblib, warnings, json, traceback, time, uuid, subprocess, sys
20
  from pathlib import Path
21
+ from typing import List, Dict, Any, Optional, Tuple
22
 
23
  import numpy as np
24
  import pandas as pd
 
850
 
851
  /* Predictor output emphasis */
852
  #pred-out .wrap { font-size: 20px; font-weight: 700; color: #ecfdf5; }
853
+
854
+ /* === (ADDED) Tab header: darker blue theme for all tabs === */
855
+ .gradio-container .tab-nav button[role="tab"] {
856
+ background: #0b1b34 !important;
857
+ color: #cfe6ff !important;
858
+ border: 1px solid #1e3a8a !important;
859
+ }
860
+ .gradio-container .tab-nav button[role="tab"][aria-selected="true"] {
861
+ background: #0e2a57 !important;
862
+ color: #e0f2fe !important;
863
+ border-color: #3b82f6 !important;
864
+ }
865
+
866
+ /* === (ADDED) Evaluate tab: enforce dark-blue text for labels/marks === */
867
+ #eval-tab .label,
868
+ #eval-tab label,
869
+ #eval-tab .gr-slider .label,
870
+ #eval-tab .wrap .label,
871
+ #eval-tab .prose,
872
+ #eval-tab .markdown,
873
+ #eval-tab p,
874
+ #eval-tab span {
875
+ color: #cfe6ff !important; /* soft, not pure white */
876
+ }
877
+
878
+ /* === (ADDED) Target the specific k-slider label strongly === */
879
+ #k-slider .label,
880
+ #k-slider label,
881
+ #k-slider .wrap .label {
882
+ color: #cfe6ff !important;
883
+ text-shadow: 0 1px 0 rgba(0,0,0,0.35);
884
+ }
885
+
886
+ /* === (ADDED) Slider track/thumb (dark blue gradient + blue thumb) === */
887
+ #eval-tab input[type="range"] {
888
+ accent-color: #3b82f6 !important; /* fallback */
889
+ }
890
+
891
+ /* WebKit */
892
+ #eval-tab input[type="range"]::-webkit-slider-runnable-track {
893
+ height: 6px;
894
+ background: linear-gradient(90deg, #0b3b68, #1e3a8a);
895
+ border-radius: 4px;
896
+ }
897
+ #eval-tab input[type="range"]::-webkit-slider-thumb {
898
+ -webkit-appearance: none;
899
+ appearance: none;
900
+ margin-top: -6px; /* centers thumb on 6px track */
901
+ width: 18px; height: 18px;
902
+ background: #1d4ed8;
903
+ border: 1px solid #60a5fa;
904
+ border-radius: 50%;
905
+ }
906
+
907
+ /* Firefox */
908
+ #eval-tab input[type="range"]::-moz-range-track {
909
+ height: 6px;
910
+ background: linear-gradient(90deg, #0b3b68, #1e3a8a);
911
+ border-radius: 4px;
912
+ }
913
+ #eval-tab input[type="range"]::-moz-range-thumb {
914
+ width: 18px; height: 18px;
915
+ background: #1d4ed8;
916
+ border: 1px solid #60a5fa;
917
+ border-radius: 50%;
918
+ }
919
  """
920
 
921
  theme = gr.themes.Soft(
 
1054
  gr.Markdown("Upload your **gold.csv** and compute metrics against the app logs.")
1055
  with gr.Row():
1056
  gold_file = gr.File(label="gold.csv", file_types=[".csv"], interactive=True)
1057
+ # (ADDED elem_id to target k slider with CSS)
1058
+ k_slider = gr.Slider(3, 12, value=8, step=1, label="k for Hit/Recall/nDCG", elem_id="k-slider")
1059
  with gr.Row():
1060
  btn_eval = gr.Button("Compute Metrics", variant="primary")
1061
  with gr.Row():