Commit
·
944f370
1
Parent(s):
dd2f0f0
improve logging in whisper_online.py
Browse files- src/whisper_streaming/online_asr.py +1 -1
- whisper_online.py +11 -8
src/whisper_streaming/online_asr.py
CHANGED
@@ -151,7 +151,7 @@ class OnlineASRProcessor:
|
|
151 |
"""
|
152 |
|
153 |
prompt, non_prompt = self.prompt()
|
154 |
-
logger.debug(f"PROMPT: {prompt}")
|
155 |
logger.debug(f"CONTEXT: {non_prompt}")
|
156 |
logger.debug(
|
157 |
f"transcribing {len(self.audio_buffer)/self.SAMPLING_RATE:2.2f} seconds from {self.buffer_time_offset:2.2f}"
|
|
|
151 |
"""
|
152 |
|
153 |
prompt, non_prompt = self.prompt()
|
154 |
+
logger.debug(f"PROMPT(previous): {prompt}")
|
155 |
logger.debug(f"CONTEXT: {non_prompt}")
|
156 |
logger.debug(
|
157 |
f"transcribing {len(self.audio_buffer)/self.SAMPLING_RATE:2.2f} seconds from {self.buffer_time_offset:2.2f}"
|
whisper_online.py
CHANGED
@@ -323,15 +323,18 @@ if __name__ == "__main__":
|
|
323 |
if now is None:
|
324 |
now = time.time() - start
|
325 |
if o[0] is not None:
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
)
|
331 |
-
print(
|
332 |
-
"%1.4f %1.0f %1.0f %s" % (now * 1000, o[0] * 1000, o[1] * 1000, o[2]),
|
333 |
-
flush=True,
|
334 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
else:
|
336 |
# No text, so no output
|
337 |
pass
|
|
|
323 |
if now is None:
|
324 |
now = time.time() - start
|
325 |
if o[0] is not None:
|
326 |
+
log_string = f"{now*1000:1.0f}, {o[0]*1000:1.0f}-{o[1]*1000:1.0f} ({(now-o[1]):+1.0f}s): {o[2]}"
|
327 |
+
|
328 |
+
logger.debug(
|
329 |
+
log_string
|
|
|
|
|
|
|
|
|
330 |
)
|
331 |
+
|
332 |
+
if logfile is not None:
|
333 |
+
print(
|
334 |
+
log_string,
|
335 |
+
file=logfile,
|
336 |
+
flush=True,
|
337 |
+
)
|
338 |
else:
|
339 |
# No text, so no output
|
340 |
pass
|