fix "words" in json response
This commit is contained in:
@@ -126,6 +126,7 @@ def stream_builder(
|
|||||||
language=language,
|
language=language,
|
||||||
task=task,
|
task=task,
|
||||||
initial_prompt=initial_prompt,
|
initial_prompt=initial_prompt,
|
||||||
|
word_timestamps=True,
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
"Detected language '%s' with probability %f"
|
"Detected language '%s' with probability %f"
|
||||||
@@ -139,6 +140,8 @@ def stream_builder(
|
|||||||
pbar.update(end - last_pos)
|
pbar.update(end - last_pos)
|
||||||
last_pos = end
|
last_pos = end
|
||||||
data = segment._asdict()
|
data = segment._asdict()
|
||||||
|
if data.get('words') is not None:
|
||||||
|
data["words"] = [i._asdict() for i in data["words"]]
|
||||||
data["total"] = info.duration
|
data["total"] = info.duration
|
||||||
yield data
|
yield data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user