hafufu-stack commited on
Commit
bf3fb5b
·
verified ·
1 Parent(s): b967abb

Fix: add api_name to all event handlers (Gradio 5.x No API found fix)

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -1032,8 +1032,8 @@ with gr.Blocks(
1032
 
1033
  gr.Examples(examples=JAILBREAK_EXAMPLES, inputs=jb_input, cache_examples=False)
1034
 
1035
- jb_submit.click(fn=check_jailbreak, inputs=jb_input, outputs=[jb_verdict, jb_metrics, jb_detail])
1036
- jb_input.submit(fn=check_jailbreak, inputs=jb_input, outputs=[jb_verdict, jb_metrics, jb_detail])
1037
 
1038
  # ==================== Tab 2: Neural Healing ====================
1039
  with gr.Tab("💊 Neural Healing"):
@@ -1066,8 +1066,8 @@ with gr.Blocks(
1066
 
1067
  gr.Examples(examples=HEALING_EXAMPLES, inputs=heal_input, cache_examples=False)
1068
 
1069
- heal_submit.click(fn=heal_prompt, inputs=heal_input, outputs=[heal_status, heal_stage, heal_output])
1070
- heal_input.submit(fn=heal_prompt, inputs=heal_input, outputs=[heal_status, heal_stage, heal_output])
1071
 
1072
  # ==================== Tab 3: Hallucination Detection ====================
1073
  with gr.Tab("🔮 Hallucination Detection (Experimental)"):
@@ -1100,8 +1100,8 @@ with gr.Blocks(
1100
 
1101
  gr.Examples(examples=HALLUCINATION_EXAMPLES, inputs=hall_input, cache_examples=False)
1102
 
1103
- hall_submit.click(fn=check_hallucination, inputs=hall_input, outputs=[hall_verdict, hall_metrics, hall_interpretation])
1104
- hall_input.submit(fn=check_hallucination, inputs=hall_input, outputs=[hall_verdict, hall_metrics, hall_interpretation])
1105
 
1106
  # ==================== Tab 4: Brain State Imaging ====================
1107
  with gr.Tab("🧠 Brain State Imaging (NEW!)"):
@@ -1138,12 +1138,14 @@ with gr.Blocks(
1138
  brain_submit.click(
1139
  fn=image_brain_state,
1140
  inputs=brain_input,
1141
- outputs=[brain_output_html, brain_summary]
 
1142
  )
1143
  brain_input.submit(
1144
  fn=image_brain_state,
1145
  inputs=brain_input,
1146
- outputs=[brain_output_html, brain_summary]
 
1147
  )
1148
  # ==================== Tab 5: Canary Pulse ====================
1149
  with gr.Tab("💓 Canary Pulse (NEW!)"):
@@ -1184,12 +1186,14 @@ with gr.Blocks(
1184
  pulse_submit.click(
1185
  fn=canary_pulse_generate,
1186
  inputs=pulse_input,
1187
- outputs=[pulse_output, pulse_chart, pulse_status]
 
1188
  )
1189
  pulse_input.submit(
1190
  fn=canary_pulse_generate,
1191
  inputs=pulse_input,
1192
- outputs=[pulse_output, pulse_chart, pulse_status]
 
1193
  )
1194
 
1195
  gr.Markdown("""
 
1032
 
1033
  gr.Examples(examples=JAILBREAK_EXAMPLES, inputs=jb_input, cache_examples=False)
1034
 
1035
+ jb_submit.click(fn=check_jailbreak, inputs=jb_input, outputs=[jb_verdict, jb_metrics, jb_detail], api_name="check_jailbreak")
1036
+ jb_input.submit(fn=check_jailbreak, inputs=jb_input, outputs=[jb_verdict, jb_metrics, jb_detail], api_name=False)
1037
 
1038
  # ==================== Tab 2: Neural Healing ====================
1039
  with gr.Tab("💊 Neural Healing"):
 
1066
 
1067
  gr.Examples(examples=HEALING_EXAMPLES, inputs=heal_input, cache_examples=False)
1068
 
1069
+ heal_submit.click(fn=heal_prompt, inputs=heal_input, outputs=[heal_status, heal_stage, heal_output], api_name="heal_prompt")
1070
+ heal_input.submit(fn=heal_prompt, inputs=heal_input, outputs=[heal_status, heal_stage, heal_output], api_name=False)
1071
 
1072
  # ==================== Tab 3: Hallucination Detection ====================
1073
  with gr.Tab("🔮 Hallucination Detection (Experimental)"):
 
1100
 
1101
  gr.Examples(examples=HALLUCINATION_EXAMPLES, inputs=hall_input, cache_examples=False)
1102
 
1103
+ hall_submit.click(fn=check_hallucination, inputs=hall_input, outputs=[hall_verdict, hall_metrics, hall_interpretation], api_name="check_hallucination")
1104
+ hall_input.submit(fn=check_hallucination, inputs=hall_input, outputs=[hall_verdict, hall_metrics, hall_interpretation], api_name=False)
1105
 
1106
  # ==================== Tab 4: Brain State Imaging ====================
1107
  with gr.Tab("🧠 Brain State Imaging (NEW!)"):
 
1138
  brain_submit.click(
1139
  fn=image_brain_state,
1140
  inputs=brain_input,
1141
+ outputs=[brain_output_html, brain_summary],
1142
+ api_name="image_brain_state"
1143
  )
1144
  brain_input.submit(
1145
  fn=image_brain_state,
1146
  inputs=brain_input,
1147
+ outputs=[brain_output_html, brain_summary],
1148
+ api_name=False
1149
  )
1150
  # ==================== Tab 5: Canary Pulse ====================
1151
  with gr.Tab("💓 Canary Pulse (NEW!)"):
 
1186
  pulse_submit.click(
1187
  fn=canary_pulse_generate,
1188
  inputs=pulse_input,
1189
+ outputs=[pulse_output, pulse_chart, pulse_status],
1190
+ api_name="canary_pulse"
1191
  )
1192
  pulse_input.submit(
1193
  fn=canary_pulse_generate,
1194
  inputs=pulse_input,
1195
+ outputs=[pulse_output, pulse_chart, pulse_status],
1196
+ api_name=False
1197
  )
1198
 
1199
  gr.Markdown("""