Claude commited on
Commit
9021659
·
1 Parent(s): eeaf6d4

fix: merge scope save into single click — push story pages to OCR fields

Browse files
Files changed (1) hide show
  1. smoke_signal_tab.py +10 -8
smoke_signal_tab.py CHANGED
@@ -2748,10 +2748,17 @@ def smoke_signal_tab():
2748
  scope_exclude = gr.Textbox(label="Story Pages Exclude", placeholder="e.g. 1,2,3,17,25", scale=1)
2749
  scope_title = gr.Textbox(label="Safe Book Title", placeholder="e.g. the-gruffalo", scale=1)
2750
  scope_save_btn = gr.Button("Save Book Pages →", size="sm")
 
 
 
 
 
 
 
2751
  scope_save_btn.click(
2752
- save_book_scope,
2753
  inputs=[scope_book_id, scope_include, scope_exclude, scope_title],
2754
- outputs=[ingest_status, manifest_table, ingest_log],
2755
  )
2756
  # ── Auto-populate: book code + year → both book ID fields ──────
2757
  def _make_book_id(code, year):
@@ -2872,12 +2879,7 @@ def smoke_signal_tab():
2872
  _default_ocr_scope_values,
2873
  outputs=[ocr_page_selection, ocr_page_exclusion],
2874
  )
2875
- # Push saved scope values live to OCR page selection when user saves on ingest
2876
- scope_save_btn.click(
2877
- lambda inc, exc: (inc or "", exc or ""),
2878
- inputs=[scope_include, scope_exclude],
2879
- outputs=[ocr_page_selection, ocr_page_exclusion],
2880
- )
2881
 
2882
  # ── STEP 4: REVIEW ────────────────────────────────────────────────
2883
  with gr.TabItem("④ Review", id="ss-review") as review_tab:
 
2748
  scope_exclude = gr.Textbox(label="Story Pages Exclude", placeholder="e.g. 1,2,3,17,25", scale=1)
2749
  scope_title = gr.Textbox(label="Safe Book Title", placeholder="e.g. the-gruffalo", scale=1)
2750
  scope_save_btn = gr.Button("Save Book Pages →", size="sm")
2751
+ def _save_scope_and_push_ocr(book_id, inc, exc, title):
2752
+ status, table, log_txt = save_book_scope(book_id, inc, exc, title)
2753
+ # Also push normalised values to OCR fields
2754
+ inc_clean = (inc or "").strip() or ""
2755
+ exc_clean = (exc or "").strip() or ""
2756
+ return status, table, log_txt, inc_clean, exc_clean
2757
+
2758
  scope_save_btn.click(
2759
+ _save_scope_and_push_ocr,
2760
  inputs=[scope_book_id, scope_include, scope_exclude, scope_title],
2761
+ outputs=[ingest_status, manifest_table, ingest_log, ocr_page_selection, ocr_page_exclusion],
2762
  )
2763
  # ── Auto-populate: book code + year → both book ID fields ──────
2764
  def _make_book_id(code, year):
 
2879
  _default_ocr_scope_values,
2880
  outputs=[ocr_page_selection, ocr_page_exclusion],
2881
  )
2882
+
 
 
 
 
 
2883
 
2884
  # ── STEP 4: REVIEW ────────────────────────────────────────────────
2885
  with gr.TabItem("④ Review", id="ss-review") as review_tab: