diff --git a/webui/app.py b/webui/app.py index 0e0f591..c98403a 100644 --- a/webui/app.py +++ b/webui/app.py @@ -181,7 +181,14 @@ def _whisper_transcribe(path: str) -> str: try: if _whisper_model is None: from faster_whisper import WhisperModel - _whisper_model = WhisperModel("small", device="cpu", compute_type="int8") + # "small" mis-heard casual contractions as formal phrasing on + # short/quiet clips (e.g. "it's gonna" -> "it is going to be") - + # "medium" is noticeably more faithful to actual speech patterns + # at the cost of a few more seconds per transcription on CPU, + # worth it since this check exists specifically to catch content + # problems - a transcript that itself distorts casual speech + # defeats that purpose. + _whisper_model = WhisperModel("medium", device="cpu", compute_type="int8") segments, _ = _whisper_model.transcribe(path, language="en", beam_size=5) return " ".join(s.text.strip() for s in segments) except Exception as e: @@ -625,7 +632,11 @@ with gr.Blocks(title="Audio-demo pipeline studio") as demo: with gr.Column(): gr.Markdown("## 2. Voice editor (AuK)") current_ref_audio = gr.Audio(label="Current reference", type="filepath", interactive=False) - ref_transcript_box = gr.Textbox(label="Whisper transcript of current reference", interactive=False) + ref_transcript_box = gr.Textbox( + label="Whisper transcript of current reference (editable - fix any mis-hearing before using it)", + info="Whisper can mishear casual speech as more formal phrasing on short/quiet clips (e.g. \"it's gonna\" -> \"it is going to be\") - correct it here before sending it anywhere.", + ) + use_ref_transcript_btn = gr.Button("Use this transcript as 'Text to speak' →") history_label = gr.Markdown("No reference set yet.") model_dd = gr.Radio( [MODEL_BASE, MODEL_FLASH], value=MODEL_BASE, label="AuK model", @@ -702,7 +713,7 @@ with gr.Blocks(title="Audio-demo pipeline studio") as demo: gen_language = gr.Dropdown(LANGUAGES, value="English", label="Language") generate_btn = gr.Button("Generate speech", variant="primary") generated_audio = gr.Audio(label="Generated speech", type="filepath") - gen_transcript_box = gr.Textbox(label="Whisper transcript", interactive=False) + gen_transcript_box = gr.Textbox(label="Whisper transcript of generated speech") gr.Markdown("## 4. Save as a the-service-station character") new_char_name = gr.Textbox(label="Name") @@ -743,6 +754,7 @@ with gr.Blocks(title="Audio-demo pipeline studio") as demo: generate_speech, inputs=[current_ref_audio, gen_text, gen_language], outputs=[generated_audio, gen_transcript_box], ) + use_ref_transcript_btn.click(lambda t: t, inputs=[ref_transcript_box], outputs=[gen_text]) save_char_btn.click( create_character, inputs=[new_char_name, new_char_role, new_char_prose, gen_language, current_ref_audio, history_state],