daihui.zhang
commited on
Commit
·
0672a0f
1
Parent(s):
aca5e0b
fix np array copy error
Browse files
transcribe/whisper_llm_serve.py
CHANGED
|
@@ -139,7 +139,7 @@ class WhisperTranscriptionService:
|
|
| 139 |
self.frames_np = frame_np.copy()
|
| 140 |
else:
|
| 141 |
self.frames_np = np.append(self.frames_np, frame_np)
|
| 142 |
-
if speech_status == "END" and len(
|
| 143 |
self.segments_queue.appendleft(self.frames_np.copy())
|
| 144 |
self.frames_np = np.array([], dtype=np.float32)
|
| 145 |
except queue.Empty:
|
|
@@ -174,7 +174,7 @@ class WhisperTranscriptionService:
|
|
| 174 |
partial = False
|
| 175 |
else:
|
| 176 |
with self.lock:
|
| 177 |
-
audio_buffer = self.frames_np[:int(frame_epoch * 1.5 * self.sample_rate)]# 获取 1.5s * epoch 个音频长度
|
| 178 |
partial = True
|
| 179 |
|
| 180 |
if len(audio_buffer) ==0:
|
|
|
|
| 139 |
self.frames_np = frame_np.copy()
|
| 140 |
else:
|
| 141 |
self.frames_np = np.append(self.frames_np, frame_np)
|
| 142 |
+
if speech_status == "END" and len(self.frames_np) > 0:
|
| 143 |
self.segments_queue.appendleft(self.frames_np.copy())
|
| 144 |
self.frames_np = np.array([], dtype=np.float32)
|
| 145 |
except queue.Empty:
|
|
|
|
| 174 |
partial = False
|
| 175 |
else:
|
| 176 |
with self.lock:
|
| 177 |
+
audio_buffer = self.frames_np[:int(frame_epoch * 1.5 * self.sample_rate)].copy()# 获取 1.5s * epoch 个音频长度
|
| 178 |
partial = True
|
| 179 |
|
| 180 |
if len(audio_buffer) ==0:
|