Pointf5ive commited on
Commit
6c9e2c1
Β·
1 Parent(s): db859e4

Fix Smoke Signal OCR runtime compatibility and restore dashboard sidebar shell

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +20 -1
  3. smoke_signal_tab.py +2 -2
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: indigo
5
  colorTo: pink
6
  sdk: gradio
7
  sdk_version: 6.14.0
8
- python_version: '3.13'
9
  app_file: app.py
10
  pinned: false
11
  ---
 
5
  colorTo: pink
6
  sdk: gradio
7
  sdk_version: 6.14.0
8
+ python_version: '3.12'
9
  app_file: app.py
10
  pinned: false
11
  ---
app.py CHANGED
@@ -1174,6 +1174,25 @@ def single_score(active_path, sequence, stanza_id, draft_pass, clarity, rhythm,
1174
  return df, _score_summary(df)
1175
 
1176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1177
  # ── GRADIO INTERFACE ──────────────────────────────────────────────────────────
1178
 
1179
  with gr.Blocks(title="TOTEM Studio") as demo:
@@ -1184,7 +1203,7 @@ with gr.Blocks(title="TOTEM Studio") as demo:
1184
 
1185
  # ── TAB 1: DASHBOARD ─────────────────────────────────────────────────
1186
  with gr.TabItem("Dashboard"):
1187
- dashboard = gr.HTML()
1188
 
1189
  with gr.Row(elem_id="studio-actions"):
1190
  with gr.Column(elem_classes=["wrap"]):
 
1174
  return df, _score_summary(df)
1175
 
1176
 
1177
+ def initial_dashboard_html() -> str:
1178
+ """
1179
+ Render dashboard shell at startup so sidebar/nav are visible immediately.
1180
+ Falls back gracefully if workbook read fails.
1181
+ """
1182
+ try:
1183
+ return dashboard_html(DEFAULT_WORKBOOK, "Dashboard ready. Click Run TOTEM Analysis to refresh metrics.")
1184
+ except Exception as exc:
1185
+ return (
1186
+ "<div style='padding:24px;font-family:system-ui,sans-serif'>"
1187
+ "<h3 style='margin:0 0 8px'>TOTEM Dashboard</h3>"
1188
+ "<p style='margin:0 0 12px;color:#666'>"
1189
+ "Dashboard shell is ready. Click <b>Run TOTEM Analysis</b> to load workbook data."
1190
+ "</p>"
1191
+ f"<p style='margin:0;color:#888;font-size:12px'>Startup note: {escape(str(exc))}</p>"
1192
+ "</div>"
1193
+ )
1194
+
1195
+
1196
  # ── GRADIO INTERFACE ──────────────────────────────────────────────────────────
1197
 
1198
  with gr.Blocks(title="TOTEM Studio") as demo:
 
1203
 
1204
  # ── TAB 1: DASHBOARD ─────────────────────────────────────────────────
1205
  with gr.TabItem("Dashboard"):
1206
+ dashboard = gr.HTML(value=initial_dashboard_html())
1207
 
1208
  with gr.Row(elem_id="studio-actions"):
1209
  with gr.Column(elem_classes=["wrap"]):
smoke_signal_tab.py CHANGED
@@ -750,8 +750,8 @@ def run_ocr() -> tuple:
750
  "rec_model": load_rec(), "rec_proc": load_rec_proc(),
751
  }
752
  log.append(log_line("βœ“ Surya models loaded"))
753
- except ImportError:
754
- log.append(log_line("⚠ Surya not installed β€” falling back to text extraction only"))
755
 
756
  queue_rows = []
757
 
 
750
  "rec_model": load_rec(), "rec_proc": load_rec_proc(),
751
  }
752
  log.append(log_line("βœ“ Surya models loaded"))
753
+ except ImportError as e:
754
+ log.append(log_line(f"⚠ Surya unavailable ({e}) β€” falling back to text extraction only"))
755
 
756
  queue_rows = []
757