cvpfus Codex commited on
Commit
4c29f47
·
1 Parent(s): 4d86717

Add demo script sample payloads

Browse files

Co-authored-by: Codex <codex@openai.com>

Files changed (3) hide show
  1. SUBMISSION.md +2 -1
  2. app.py +21 -2
  3. scripts/verify.py +7 -0
SUBMISSION.md CHANGED
@@ -44,7 +44,8 @@ The prototype is designed for a live hackathon demo: every model-facing path has
44
  - `/api/demo-script`: repeatable judge runbook and API checks.
45
  - `/api/image-descriptions`: generated article image descriptions for reader mode.
46
 
 
 
47
  ## Reliability notes
48
 
49
  The demo remains navigable when local models are unavailable. The reader brain falls back to deterministic narration, image descriptions fall back to cached alt text, speech falls back to browser speech plus transcript, and generated images fall back to bundled article assets. Fallback states are labeled instead of hidden.
50
-
 
44
  - `/api/demo-script`: repeatable judge runbook and API checks.
45
  - `/api/image-descriptions`: generated article image descriptions for reader mode.
46
 
47
+ The POST checks in `/api/demo-script` include sample JSON bodies for `/api/reader-brain` and `/api/speak`.
48
+
49
  ## Reliability notes
50
 
51
  The demo remains navigable when local models are unavailable. The reader brain falls back to deterministic narration, image descriptions fall back to cached alt text, speech falls back to browser speech plus transcript, and generated images fall back to bundled article assets. Fallback states are labeled instead of hidden.
 
app.py CHANGED
@@ -240,8 +240,27 @@ def demo_script_core() -> dict[str, Any]:
240
  {"method": "GET", "path": "/api/runtime-status", "expect": "online or fallback-ready runtime labels"},
241
  {"method": "GET", "path": "/api/accessibility-audit", "expect": "all reader-mode checks pass"},
242
  {"method": "GET", "path": "/api/image-descriptions", "expect": "three article image descriptions"},
243
- {"method": "POST", "path": "/api/reader-brain", "expect": "concise narration or fallback narration"},
244
- {"method": "POST", "path": "/api/speak", "expect": "Kokoro audio or audible browser fallback path"},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  ],
246
  }
247
 
 
240
  {"method": "GET", "path": "/api/runtime-status", "expect": "online or fallback-ready runtime labels"},
241
  {"method": "GET", "path": "/api/accessibility-audit", "expect": "all reader-mode checks pass"},
242
  {"method": "GET", "path": "/api/image-descriptions", "expect": "three article image descriptions"},
243
+ {
244
+ "method": "POST",
245
+ "path": "/api/reader-brain",
246
+ "expect": "concise narration or fallback narration",
247
+ "sample_body": {
248
+ "node_type": "heading",
249
+ "text": "The model map",
250
+ "position": "item 4 of 10",
251
+ "mode": "narrate",
252
+ },
253
+ },
254
+ {
255
+ "method": "POST",
256
+ "path": "/api/speak",
257
+ "expect": "Kokoro audio or audible browser fallback path",
258
+ "sample_body": {
259
+ "text": "Heading. The model map.",
260
+ "voice": READER_SETTINGS["default_voice"],
261
+ "speed": READER_SETTINGS["default_speed"],
262
+ },
263
+ },
264
  ],
265
  }
266
 
scripts/verify.py CHANGED
@@ -290,6 +290,13 @@ def verify_routes() -> None:
290
  any(item["path"] == "/api/accessibility-audit" for item in demo_payload["api_checks"]),
291
  "Demo script should include the accessibility audit check",
292
  )
 
 
 
 
 
 
 
293
 
294
  audit = client.get("/api/accessibility-audit")
295
  assert_true(audit.status_code == 200, "Accessibility audit route should return 200")
 
290
  any(item["path"] == "/api/accessibility-audit" for item in demo_payload["api_checks"]),
291
  "Demo script should include the accessibility audit check",
292
  )
293
+ reader_check = next(item for item in demo_payload["api_checks"] if item["path"] == "/api/reader-brain")
294
+ speech_check = next(item for item in demo_payload["api_checks"] if item["path"] == "/api/speak")
295
+ assert_true(reader_check["sample_body"]["mode"] == "narrate", "Reader-brain demo check should include a sample body")
296
+ assert_true(
297
+ speech_check["sample_body"]["voice"] == app.READER_SETTINGS["default_voice"],
298
+ "Speech demo check should use the default reader voice",
299
+ )
300
 
301
  audit = client.get("/api/accessibility-audit")
302
  assert_true(audit.status_code == 200, "Accessibility audit route should return 200")