Claude commited on
Commit
2d7fa7e
Β·
1 Parent(s): c3a052e

refactor: remove profile tab, fix nan font, full OCR progress bar, renumber tabs

Browse files
Files changed (1) hide show
  1. smoke_signal_tab.py +7 -27
smoke_signal_tab.py CHANGED
@@ -2578,7 +2578,8 @@ def get_review_item(idx: int) -> tuple:
2578
  f"conf: <b style='color:{'var(--ss-red)' if float(item.get('confidence',0)) < 0.6 else 'var(--ss-gold)'}'>"
2579
  f"{float(item.get('confidence',0)):.0%}</b></div>")
2580
 
2581
- font_name_val = str(item.get("font_name", "") or "").strip()
 
2582
  return img_path, item.get("raw_ocr",""), info, len(q_df) - len(pending), len(q_df), font_name_val
2583
 
2584
 
@@ -2918,7 +2919,7 @@ def smoke_signal_tab():
2918
  inputs=[pdf_upload, rights_dd, ingest_notes, book_code_input, pub_year_input,
2919
  scope_include, scope_exclude, scope_title],
2920
  outputs=[ingest_status, ingest_log, pipeline_done],
2921
- show_progress="minimal",
2922
  trigger_mode="once",
2923
  )
2924
  # Refresh manifest after pipeline completes
@@ -2935,28 +2936,8 @@ def smoke_signal_tab():
2935
  # Auto-load removed β€” use Refresh button instead to avoid SSR hang
2936
 
2937
  # ── STEP 2: PROFILE ───────────────────────────────────────────────
2938
- with gr.TabItem("β‘‘ Profile (Optional)", id="ss-profile") as profile_tab:
2939
- gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
2940
- <div class="ss-panel-icon">πŸ”</div>
2941
- <div><p class="ss-panel-title">PDF Profiler</p>
2942
- <p class="ss-panel-sub">Auto-runs during ingest Β· use here only for manual re-profile</p></div>
2943
- </div>""")
2944
-
2945
- profile_status = gr.HTML(_profile_status_html())
2946
- profile_btn = gr.Button("Re-run Profiler (Optional) β†’", elem_classes=["ss-btn-run"])
2947
- profile_log = gr.Textbox(label="Log", lines=10, interactive=False, elem_classes=["ss-log"])
2948
- profile_copy_log_btn = gr.Button("Copy Log", size="sm")
2949
-
2950
- profile_btn.click(run_profile, outputs=[profile_status, profile_log])
2951
- profile_copy_log_btn.click(
2952
- fn=None,
2953
- inputs=[profile_log],
2954
- outputs=[],
2955
- js="(logTxt) => { if (navigator && navigator.clipboard) { navigator.clipboard.writeText(logTxt || ''); } return []; }",
2956
- )
2957
-
2958
- # ── STEP 3: OCR ───────────────────────────────────────────────────
2959
- with gr.TabItem("β‘’ OCR", id="ss-ocr") as ocr_tab:
2960
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
2961
  <div class="ss-panel-icon">πŸ‘</div>
2962
  <div><p class="ss-panel-title">OCR Engine</p>
@@ -3032,7 +3013,7 @@ def smoke_signal_tab():
3032
 
3033
 
3034
  # ── STEP 4: REVIEW ────────────────────────────────────────────────
3035
- with gr.TabItem("β‘£ Review", id="ss-review") as review_tab:
3036
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
3037
  <div class="ss-panel-icon">✎</div>
3038
  <div><p class="ss-panel-title">Review Workbench</p>
@@ -3170,7 +3151,7 @@ def smoke_signal_tab():
3170
  # Review now auto-loads on tab select and after OCR run completion.
3171
 
3172
  # ── STEP 5: EXPORT ────────────────────────────────────────────────
3173
- with gr.TabItem("β‘€ Export", id="ss-export") as export_tab:
3174
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
3175
  <div class="ss-panel-icon">⬇</div>
3176
  <div><p class="ss-panel-title">Codex Export</p>
@@ -3202,7 +3183,6 @@ def smoke_signal_tab():
3202
  )
3203
 
3204
  ingest_tab.select(lambda: _wizard_header_html(1), outputs=[wizard_header])
3205
- profile_tab.select(lambda: _wizard_header_html(2), outputs=[wizard_header])
3206
  ocr_tab.select(lambda: _wizard_header_html(3), outputs=[wizard_header])
3207
  review_tab.select(lambda: _wizard_header_html(4), outputs=[wizard_header])
3208
  export_tab.select(lambda: _wizard_header_html(5), outputs=[wizard_header])
 
2578
  f"conf: <b style='color:{'var(--ss-red)' if float(item.get('confidence',0)) < 0.6 else 'var(--ss-gold)'}'>"
2579
  f"{float(item.get('confidence',0)):.0%}</b></div>")
2580
 
2581
+ raw_font = item.get("font_name", "") or ""
2582
+ font_name_val = "" if str(raw_font).lower() in ("nan", "none", "") else str(raw_font).strip()
2583
  return img_path, item.get("raw_ocr",""), info, len(q_df) - len(pending), len(q_df), font_name_val
2584
 
2585
 
 
2919
  inputs=[pdf_upload, rights_dd, ingest_notes, book_code_input, pub_year_input,
2920
  scope_include, scope_exclude, scope_title],
2921
  outputs=[ingest_status, ingest_log, pipeline_done],
2922
+ show_progress="full",
2923
  trigger_mode="once",
2924
  )
2925
  # Refresh manifest after pipeline completes
 
2936
  # Auto-load removed β€” use Refresh button instead to avoid SSR hang
2937
 
2938
  # ── STEP 2: PROFILE ───────────────────────────────────────────────
2939
+ # ── STEP 2: OCR ───────────────────────────────────────────────────
2940
+ with gr.TabItem("β‘‘ OCR", id="ss-ocr") as ocr_tab:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2941
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
2942
  <div class="ss-panel-icon">πŸ‘</div>
2943
  <div><p class="ss-panel-title">OCR Engine</p>
 
3013
 
3014
 
3015
  # ── STEP 4: REVIEW ────────────────────────────────────────────────
3016
+ with gr.TabItem("β‘’ Review", id="ss-review") as review_tab:
3017
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
3018
  <div class="ss-panel-icon">✎</div>
3019
  <div><p class="ss-panel-title">Review Workbench</p>
 
3151
  # Review now auto-loads on tab select and after OCR run completion.
3152
 
3153
  # ── STEP 5: EXPORT ────────────────────────────────────────────────
3154
+ with gr.TabItem("β‘£ Export", id="ss-export") as export_tab:
3155
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
3156
  <div class="ss-panel-icon">⬇</div>
3157
  <div><p class="ss-panel-title">Codex Export</p>
 
3183
  )
3184
 
3185
  ingest_tab.select(lambda: _wizard_header_html(1), outputs=[wizard_header])
 
3186
  ocr_tab.select(lambda: _wizard_header_html(3), outputs=[wizard_header])
3187
  review_tab.select(lambda: _wizard_header_html(4), outputs=[wizard_header])
3188
  export_tab.select(lambda: _wizard_header_html(5), outputs=[wizard_header])