INNER CODE UNIT · Python
runtime
sanchit-gandhi/whisper-jax · app/app.py:116
runtime = time.time() - start_time
logger.info("done transcription")
logger.info("post-processing...")
post_processed = pipeline.postprocess(model_outputs, return_timestamps=True)
text = post_processed["text"]
if return_timestamps:
timestamps = post_processed.get("chunks")
timestamps = [
f"[{format_timestamp(chunk['timestamp'][0])} -> {format_timestamp(chunk['timestamp'][1])}] {chunk['text']}"
for chunk in timestamps
]
text = "\n".join(str(feature) for feature in timestamps)
logger.info("done post-processing")
return text, runtime
def transcribe_chunked_audio(inputs, task, return_timestamps, progress=gr.Progress()):
progress(0, desc="Loading audio file...")