

chore: add a more descriptive assert error message (#58)
@056a6ffd392a8f7123379d4362751cf18041f4e4
--- faster_whisper_server/core.py
+++ faster_whisper_server/core.py
... | ... | @@ -23,7 +23,11 @@ |
23 | 23 |
def from_segments(cls, segments: Iterable[Segment]) -> list[Word]: |
24 | 24 |
words: list[Word] = [] |
25 | 25 |
for segment in segments: |
26 |
- assert segment.words is not None |
|
26 |
+ # NOTE: a temporary "fix" for https://github.com/fedirz/faster-whisper-server/issues/58. |
|
27 |
+ # TODO: properly address the issue |
|
28 |
+ assert ( |
|
29 |
+ segment.words is not None |
|
30 |
+ ), "Segment must have words. If you are using an API ensure `timestamp_granularities[]=word` is set" |
|
27 | 31 |
words.extend(segment.words) |
28 | 32 |
return words |
29 | 33 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?