Joseph Antolick Claude Opus 4.8 commited on
Commit ·
d40ce7b
1
Parent(s): 8e5e42f
Only run a check on button press, not on paste/upload
Browse filesRemoved the image upload/paste auto-trigger; pasting now just loads the
image and the user presses the button to analyze.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -113,15 +113,12 @@ with gr.Blocks(title="TemperCheck") as demo:
|
|
| 113 |
result = gr.Markdown(label="Verdict")
|
| 114 |
with gr.Accordion("Raw model output (agent trace)", open=False):
|
| 115 |
raw = gr.Code(label="raw")
|
| 116 |
-
#
|
| 117 |
-
#
|
| 118 |
-
# restores the button.
|
| 119 |
go.click(_disable_button, None, go).then(
|
| 120 |
analyze, inputs=image_in, outputs=[result, raw]
|
| 121 |
).then(_enable_button, None, go)
|
| 122 |
-
image_in.upload(_disable_button, None, go).then(
|
| 123 |
-
analyze, inputs=image_in, outputs=[result, raw]
|
| 124 |
-
).then(_enable_button, None, go)
|
| 125 |
gr.Markdown(f"<sub>Backend: `{get_backend_name()}`</sub>")
|
| 126 |
demo.load(None, None, None, js=PASTE_JS)
|
| 127 |
|
|
|
|
| 113 |
result = gr.Markdown(label="Verdict")
|
| 114 |
with gr.Accordion("Raw model output (agent trace)", open=False):
|
| 115 |
raw = gr.Code(label="raw")
|
| 116 |
+
# Only the button runs a check — pasting/uploading just loads the image.
|
| 117 |
+
# Disable the button while the check runs, then re-enable it; analyze() never
|
| 118 |
+
# raises, so the final .then always restores the button.
|
| 119 |
go.click(_disable_button, None, go).then(
|
| 120 |
analyze, inputs=image_in, outputs=[result, raw]
|
| 121 |
).then(_enable_button, None, go)
|
|
|
|
|
|
|
|
|
|
| 122 |
gr.Markdown(f"<sub>Backend: `{get_backend_name()}`</sub>")
|
| 123 |
demo.load(None, None, None, js=PASTE_JS)
|
| 124 |
|