improve logging in whisper_online.py

This commit is contained in:
Silas Kieser
2025-01-21 14:59:36 +01:00
parent 69a2ed6bfb
commit f0eaffacd3
2 changed files with 12 additions and 9 deletions

View File

@@ -151,7 +151,7 @@ class OnlineASRProcessor:
"""
prompt, non_prompt = self.prompt()
logger.debug(f"PROMPT: {prompt}")
logger.debug(f"PROMPT(previous): {prompt}")
logger.debug(f"CONTEXT: {non_prompt}")
logger.debug(
f"transcribing {len(self.audio_buffer)/self.SAMPLING_RATE:2.2f} seconds from {self.buffer_time_offset:2.2f}"

View File

@@ -323,15 +323,18 @@ if __name__ == "__main__":
if now is None:
now = time.time() - start
if o[0] is not None:
print(
"%1.4f %1.0f %1.0f %s" % (now * 1000, o[0] * 1000, o[1] * 1000, o[2]),
file=logfile,
flush=True,
)
print(
"%1.4f %1.0f %1.0f %s" % (now * 1000, o[0] * 1000, o[1] * 1000, o[2]),
flush=True,
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]}"
logger.debug(
log_string
)
if logfile is not None:
print(
log_string,
file=logfile,
flush=True,
)
else:
# No text, so no output
pass