From 6f71fa65fb8d6efaf54cde474009e9d78bebfe94 Mon Sep 17 00:00:00 2001 From: Stepan Zuev Date: Fri, 5 Apr 2024 07:00:07 +0300 Subject: [PATCH] smart transcript fix --- gradio_app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradio_app.py b/gradio_app.py index 310e6f8..d14433f 100644 --- a/gradio_app.py +++ b/gradio_app.py @@ -235,10 +235,10 @@ def run(seed, left_margin, right_margin, codec_audio_sr, codec_sr, top_k, top_p, target_transcript = "" for word in transcribe_state["words_info"]: if word["end"] < prompt_end_time: - target_transcript += word["word"] + target_transcript += word["word"] + (" " if word["word"][-1] != " " else "") elif (word["start"] + word["end"]) / 2 < prompt_end_time: # include part of the word it it's big, but adjust prompt_end_time - target_transcript += word["word"] + target_transcript += word["word"] + (" " if word["word"][-1] != " " else "") prompt_end_time = word["end"] break else: @@ -263,13 +263,13 @@ def run(seed, left_margin, right_margin, codec_audio_sr, codec_sr, top_k, top_p, target_transcript = "" for word in transcribe_state["words_info"]: if word["start"] < edit_start_time: - target_transcript += word["word"] + target_transcript += word["word"] + (" " if word["word"][-1] != " " else "") else: break target_transcript += f" {sentence}" for word in transcribe_state["words_info"]: if word["end"] > edit_end_time: - target_transcript += word["word"] + target_transcript += word["word"] + (" " if word["word"][-1] != " " else "") else: target_transcript = sentence