feat(srt,ui): auto-generate SRT from inference segments; preview & download in Web UI #476
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What - add an optional return_segments path to indextts/infer_v2.py, collecting per-segment text/sample metadata during synthesis. - teach webui.py to request segment metadata, write a sibling .srt when available, and surface subtitle preview + download. - tweak the generation tab layout to host the new UI elements while keeping audio UX unchanged.
Why - subtitles appear instantly alongside generated audio, eliminating post-hoc alignment steps and improving usability.
Details - paths: indextts/infer_v2.py:326-674, webui.py:107-224, webui.py:245-499. - helper functions normalize tokenizer output and format SRT timestamps. - backward compatible: default audio-only inference still returns the original structure when return_segments=False.
Tests - python -m compileall webui.py indextts/infer_v2.py - manual: run the Web UI, generate audio, confirm .srt appears next to the .wav and the preview/download widgets work.
Notes - restored upstream-tracked example audio and docs to avoid unintended deletions. - follow-up idea (separate PR): extend the CLI path to emit .srt when return_segments=True.