Militaryint commited on
Commit
9962c14
·
verified ·
1 Parent(s): 206baac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -3
app.py CHANGED
@@ -586,12 +586,38 @@ with gr.Blocks() as demo:
586
 
587
  with gr.Tab("Threat Readiness"):
588
  gr.Markdown("## Threat Readiness — color-coded commander brief (administrative only)")
 
 
 
 
 
 
 
589
  threat_button = gr.Button("Evaluate Threat Readiness")
590
  threat_output = gr.Textbox(label="Threat Readiness & Admin Diagnostics", lines=28)
591
- threat_button.click(fn=lambda *args: evaluate_threat_brief(*args),
592
- inputs=std_inputs + a_inputs + b_inputs + c_inputs,
593
- outputs=threat_output)
594
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  gr.Markdown("**Safety note:** This tool is restricted to administrative/doctrinal outputs. It will refuse to provide any operational, tactical, or targeting information. If such content is requested or appears in model output, it will be redacted and replaced with a non-actionable administrative alternative.")
596
 
597
  if __name__ == "__main__":
 
586
 
587
  with gr.Tab("Threat Readiness"):
588
  gr.Markdown("## Threat Readiness — color-coded commander brief (administrative only)")
589
+
590
+ # Hidden states to capture answers from other tabs
591
+ std_state = gr.State()
592
+ a_state = gr.State()
593
+ b_state = gr.State()
594
+ c_state = gr.State()
595
+
596
  threat_button = gr.Button("Evaluate Threat Readiness")
597
  threat_output = gr.Textbox(label="Threat Readiness & Admin Diagnostics", lines=28)
 
 
 
598
 
599
+ # Capture answers whenever reports are generated
600
+ def cache_std(*answers):
601
+ return list(answers)
602
+ std_button.click(cache_std, inputs=std_inputs, outputs=[std_state])
603
+
604
+ def cache_enh(*answers):
605
+ la, lb, lc = len(ENH_SECTION_A), len(ENH_SECTION_B), len(ENH_SECTION_C)
606
+ a_vals = answers[:la]
607
+ b_vals = answers[la:la+lb]
608
+ c_vals = answers[la+lb:la+lb+lc]
609
+ return a_vals, b_vals, c_vals
610
+ enh_button.click(cache_enh, inputs=a_inputs+b_inputs+c_inputs+[gate_input],
611
+ outputs=[a_state, b_state, c_state])
612
+
613
+ def threat_runner(std_ans, a_ans, b_ans, c_ans):
614
+ # flatten all answers
615
+ all_vals = (std_ans or []) + (a_ans or []) + (b_ans or []) + (c_ans or [])
616
+ return evaluate_threat_brief(*all_vals)
617
+
618
+ threat_button.click(threat_runner, inputs=[std_state, a_state, b_state, c_state], outputs=threat_output)
619
+
620
+
621
  gr.Markdown("**Safety note:** This tool is restricted to administrative/doctrinal outputs. It will refuse to provide any operational, tactical, or targeting information. If such content is requested or appears in model output, it will be redacted and replaced with a non-actionable administrative alternative.")
622
 
623
  if __name__ == "__main__":