improve logging in whisper_online.py
This commit is contained in:
parent
69a2ed6bfb
commit
f0eaffacd3
2 changed files with 12 additions and 9 deletions
|
|
@ -151,7 +151,7 @@ class OnlineASRProcessor:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
prompt, non_prompt = self.prompt()
|
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"CONTEXT: {non_prompt}")
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"transcribing {len(self.audio_buffer)/self.SAMPLING_RATE:2.2f} seconds from {self.buffer_time_offset:2.2f}"
|
f"transcribing {len(self.audio_buffer)/self.SAMPLING_RATE:2.2f} seconds from {self.buffer_time_offset:2.2f}"
|
||||||
|
|
|
||||||
|
|
@ -323,15 +323,18 @@ if __name__ == "__main__":
|
||||||
if now is None:
|
if now is None:
|
||||||
now = time.time() - start
|
now = time.time() - start
|
||||||
if o[0] is not None:
|
if o[0] is not None:
|
||||||
print(
|
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]}"
|
||||||
"%1.4f %1.0f %1.0f %s" % (now * 1000, o[0] * 1000, o[1] * 1000, o[2]),
|
|
||||||
file=logfile,
|
logger.debug(
|
||||||
flush=True,
|
log_string
|
||||||
)
|
|
||||||
print(
|
|
||||||
"%1.4f %1.0f %1.0f %s" % (now * 1000, o[0] * 1000, o[1] * 1000, o[2]),
|
|
||||||
flush=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if logfile is not None:
|
||||||
|
print(
|
||||||
|
log_string,
|
||||||
|
file=logfile,
|
||||||
|
flush=True,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# No text, so no output
|
# No text, so no output
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue