Fix split long audio bug

This commit is contained in:
wugren
2023-11-22 19:05:05 +08:00
parent b305a963ba
commit 7564349cb7
+5 -2
View File
@@ -101,9 +101,12 @@ class WhisperComputeNode(ComputeNode):
text = ""
results = []
latest_resp = None
step = 30 * 1000
for i in range(0, 60 * 1000, step):
step = 10 * 60 * 1000
for i in range(0, len(audio), step):
if i + step < len(audio):
chunk = audio[i:i + step]
else:
chunk = audio[i:]
seg_file = io.BytesIO()
chunk.export(seg_file, format="mp3")
seg_file.seek(0)