Pointf5ive commited on
Commit
d3ec1d6
Β·
1 Parent(s): 5ffc645

Fix Gradio 6 runtime crash in Smoke Signal tab

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. smoke_signal_tab.py +6 -9
app.py CHANGED
@@ -1176,7 +1176,7 @@ def single_score(active_path, sequence, stanza_id, draft_pass, clarity, rhythm,
1176
 
1177
  # ── GRADIO INTERFACE ──────────────────────────────────────────────────────────
1178
 
1179
- with gr.Blocks(title="TOTEM Studio", css=CSS + SS_CSS, head=HEAD) as demo:
1180
  active_path = gr.State(str(DEFAULT_WORKBOOK))
1181
  log_state = gr.State(pd.DataFrame(columns=LOG_COLUMNS))
1182
 
@@ -1389,4 +1389,4 @@ with gr.Blocks(title="TOTEM Studio", css=CSS + SS_CSS, head=HEAD) as demo:
1389
 
1390
 
1391
  if __name__ == "__main__":
1392
- demo.launch()
 
1176
 
1177
  # ── GRADIO INTERFACE ──────────────────────────────────────────────────────────
1178
 
1179
+ with gr.Blocks(title="TOTEM Studio") as demo:
1180
  active_path = gr.State(str(DEFAULT_WORKBOOK))
1181
  log_state = gr.State(pd.DataFrame(columns=LOG_COLUMNS))
1182
 
 
1389
 
1390
 
1391
  if __name__ == "__main__":
1392
+ demo.launch(css=CSS + SS_CSS, head=HEAD)
smoke_signal_tab.py CHANGED
@@ -1143,6 +1143,7 @@ def smoke_signal_tab():
1143
  label="Source Manifest",
1144
  interactive=False,
1145
  wrap=True,
 
1146
  )
1147
  ingest_log = gr.Textbox(label="Log", lines=6, interactive=False, elem_classes=["ss-log"])
1148
 
@@ -1152,7 +1153,6 @@ def smoke_signal_tab():
1152
  outputs=[ingest_status, manifest_table, ingest_log],
1153
  )
1154
  gr.HTML('<div style="height:16px"></div>')
1155
- wizard.load(lambda: (load_manifest_df(),), outputs=[manifest_table])
1156
 
1157
  # ── STEP 2: PROFILE ───────────────────────────────────────────────
1158
  with gr.TabItem("β‘‘ Profile", id="ss-profile"):
@@ -1202,6 +1202,7 @@ def smoke_signal_tab():
1202
 
1203
  review_status = gr.HTML(_review_status_html())
1204
  training_feedback = gr.HTML()
 
1205
 
1206
  with gr.Row():
1207
  with gr.Column(scale=2):
@@ -1210,19 +1211,22 @@ def smoke_signal_tab():
1210
  type="filepath",
1211
  height=420,
1212
  show_download_button=False,
 
1213
  )
1214
- item_info = gr.HTML()
1215
 
1216
  with gr.Column(scale=2):
1217
  raw_text_box = gr.Textbox(
1218
  label="Raw OCR",
1219
  lines=6,
1220
  interactive=False,
 
1221
  )
1222
  final_text_box = gr.Textbox(
1223
  label="Final Text (edit to correct)",
1224
  lines=8,
1225
  interactive=True,
 
1226
  )
1227
  reviewer_name = gr.Textbox(label="Your name", placeholder="e.g. jamal", scale=1)
1228
  reason_code = gr.Dropdown(
@@ -1246,11 +1250,6 @@ def smoke_signal_tab():
1246
  review_outputs = [training_feedback, review_image, raw_text_box, item_info,
1247
  gr.State(), gr.State()]
1248
 
1249
- def load_review():
1250
- img, raw, info, done, total = get_review_item(0)
1251
- status = _review_status_html()
1252
- return status, img, raw, raw, info
1253
-
1254
  def next_item(idx):
1255
  new_idx = idx + 1
1256
  img, raw, info, done, total = get_review_item(new_idx)
@@ -1294,8 +1293,6 @@ def smoke_signal_tab():
1294
  next_btn.click(_next, inputs=[current_idx],
1295
  outputs=[current_idx, review_image, raw_text_box, final_text_box, item_info])
1296
 
1297
- wizard.load(load_review, outputs=[review_status, review_image, raw_text_box, final_text_box, item_info])
1298
-
1299
  # ── STEP 5: EXPORT ────────────────────────────────────────────────
1300
  with gr.TabItem("β‘€ Export", id="ss-export"):
1301
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">
 
1143
  label="Source Manifest",
1144
  interactive=False,
1145
  wrap=True,
1146
+ value=load_manifest_df(),
1147
  )
1148
  ingest_log = gr.Textbox(label="Log", lines=6, interactive=False, elem_classes=["ss-log"])
1149
 
 
1153
  outputs=[ingest_status, manifest_table, ingest_log],
1154
  )
1155
  gr.HTML('<div style="height:16px"></div>')
 
1156
 
1157
  # ── STEP 2: PROFILE ───────────────────────────────────────────────
1158
  with gr.TabItem("β‘‘ Profile", id="ss-profile"):
 
1202
 
1203
  review_status = gr.HTML(_review_status_html())
1204
  training_feedback = gr.HTML()
1205
+ init_img, init_raw, init_info, _, _ = get_review_item(0)
1206
 
1207
  with gr.Row():
1208
  with gr.Column(scale=2):
 
1211
  type="filepath",
1212
  height=420,
1213
  show_download_button=False,
1214
+ value=init_img,
1215
  )
1216
+ item_info = gr.HTML(value=init_info)
1217
 
1218
  with gr.Column(scale=2):
1219
  raw_text_box = gr.Textbox(
1220
  label="Raw OCR",
1221
  lines=6,
1222
  interactive=False,
1223
+ value=init_raw,
1224
  )
1225
  final_text_box = gr.Textbox(
1226
  label="Final Text (edit to correct)",
1227
  lines=8,
1228
  interactive=True,
1229
+ value=init_raw,
1230
  )
1231
  reviewer_name = gr.Textbox(label="Your name", placeholder="e.g. jamal", scale=1)
1232
  reason_code = gr.Dropdown(
 
1250
  review_outputs = [training_feedback, review_image, raw_text_box, item_info,
1251
  gr.State(), gr.State()]
1252
 
 
 
 
 
 
1253
  def next_item(idx):
1254
  new_idx = idx + 1
1255
  img, raw, info, done, total = get_review_item(new_idx)
 
1293
  next_btn.click(_next, inputs=[current_idx],
1294
  outputs=[current_idx, review_image, raw_text_box, final_text_box, item_info])
1295
 
 
 
1296
  # ── STEP 5: EXPORT ────────────────────────────────────────────────
1297
  with gr.TabItem("β‘€ Export", id="ss-export"):
1298
  gr.HTML("""<div class="ss-panel-header" style="padding:20px 0 0 0">