Spaces:
Configuration error
Configuration error
Fedir Zadniprovskyi
commited on
Commit
·
23ca7f9
1
Parent(s):
65e955b
chore: add a more descriptive assert error message (#58)
Browse files
faster_whisper_server/core.py
CHANGED
@@ -23,7 +23,11 @@ class Word(BaseModel):
|
|
23 |
def from_segments(cls, segments: Iterable[Segment]) -> list[Word]:
|
24 |
words: list[Word] = []
|
25 |
for segment in segments:
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
words.extend(segment.words)
|
28 |
return words
|
29 |
|
|
|
23 |
def from_segments(cls, segments: Iterable[Segment]) -> list[Word]:
|
24 |
words: list[Word] = []
|
25 |
for segment in segments:
|
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"
|
31 |
words.extend(segment.words)
|
32 |
return words
|
33 |
|