Merge branch 'dev'
Browse files* dev:
update traffic time log
transcribe/whisper_llm_serve.py
CHANGED
|
@@ -225,7 +225,7 @@ class WhisperTranscriptionService(ServeClientBase):
|
|
| 225 |
|
| 226 |
if not segments:
|
| 227 |
return
|
| 228 |
-
|
| 229 |
for ana_result in self._transcrible_analysis.analysis(segments, len(audio_buffer)/self.sample_rate):
|
| 230 |
if (cut_index :=ana_result.cut_index)>0:
|
| 231 |
# 更新音频缓冲区,移除已处理部分
|
|
@@ -234,7 +234,7 @@ class WhisperTranscriptionService(ServeClientBase):
|
|
| 234 |
translated_context = self._translate_text(ana_result.context)
|
| 235 |
else:
|
| 236 |
translated_context = self._translate_text_large(ana_result.context)
|
| 237 |
-
|
| 238 |
yield TransResult(
|
| 239 |
seg_id=ana_result.seg_id,
|
| 240 |
context=ana_result.context,
|
|
@@ -243,6 +243,9 @@ class WhisperTranscriptionService(ServeClientBase):
|
|
| 243 |
tran_content=translated_context,
|
| 244 |
partial=ana_result.partial()
|
| 245 |
)
|
|
|
|
|
|
|
|
|
|
| 246 |
|
| 247 |
|
| 248 |
def _send_result_to_client(self, result: TransResult) -> None:
|
|
|
|
| 225 |
|
| 226 |
if not segments:
|
| 227 |
return
|
| 228 |
+
start_time = time.perf_counter()
|
| 229 |
for ana_result in self._transcrible_analysis.analysis(segments, len(audio_buffer)/self.sample_rate):
|
| 230 |
if (cut_index :=ana_result.cut_index)>0:
|
| 231 |
# 更新音频缓冲区,移除已处理部分
|
|
|
|
| 234 |
translated_context = self._translate_text(ana_result.context)
|
| 235 |
else:
|
| 236 |
translated_context = self._translate_text_large(ana_result.context)
|
| 237 |
+
|
| 238 |
yield TransResult(
|
| 239 |
seg_id=ana_result.seg_id,
|
| 240 |
context=ana_result.context,
|
|
|
|
| 243 |
tran_content=translated_context,
|
| 244 |
partial=ana_result.partial()
|
| 245 |
)
|
| 246 |
+
current_time = time.perf_counter()
|
| 247 |
+
time_diff = current_time - start_time
|
| 248 |
+
log_block("🚦 Traffic timestamp diff: ", round(time_diff, 2), 's')
|
| 249 |
|
| 250 |
|
| 251 |
def _send_result_to_client(self, result: TransResult) -> None:
|