Codex Claude Sonnet 4.6 commited on
Commit ·
9ff3a4b
1
Parent(s): 620b7e6
Yield audio before PDF: narration ready first, then downloads
Browse filesAdd an intermediate yield after TTS completes that surfaces the audio
player and book HTML immediately, before PDF generation begins. The PDF
download button then appears in the next yield once the file is ready.
User can start listening the moment narration is done.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -908,6 +908,11 @@ def create_book(doodle_image, theme, hero_name,
|
|
| 908 |
trace_data["tts_error"] = repr(voice_box["err"])
|
| 909 |
trace_data["tts_sec"] = round(time.perf_counter() - t_tts, 2)
|
| 910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
pdf_path = None
|
| 912 |
t_pdf = time.perf_counter()
|
| 913 |
try:
|
|
|
|
| 908 |
trace_data["tts_error"] = repr(voice_box["err"])
|
| 909 |
trace_data["tts_sec"] = round(time.perf_counter() - t_tts, 2)
|
| 910 |
|
| 911 |
+
# Yield audio + book NOW so the user can start listening immediately.
|
| 912 |
+
# PDFs come in the next yield, after they finish generating.
|
| 913 |
+
yield (book_html, f"{title} — story ready! Generating PDF…",
|
| 914 |
+
audio_path, _keep, story, "", json.dumps(trace_data, indent=2), _no, _keep)
|
| 915 |
+
|
| 916 |
pdf_path = None
|
| 917 |
t_pdf = time.perf_counter()
|
| 918 |
try:
|