From 19145ca1a4da85031d24283f0d82debc12c902dc Mon Sep 17 00:00:00 2001 From: Christian Rute Date: Thu, 16 Jan 2025 16:27:50 +0100 Subject: [PATCH] add copy button --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 730ce67..dafbff5 100644 --- a/app.py +++ b/app.py @@ -71,11 +71,13 @@ def save_audio_to_wav(audio, filename): wf.setframerate(SAMPLE_RATE) wf.writeframes(audio.tobytes()) + def get_audio_duration(filename): """Returns the duration of the audio file in seconds.""" audio = AudioSegment.from_wav(filename) return len(audio) / 1000 + def split_audio(filename, chunk_length_ms=30000): """Splits an audio file into chunks.""" audio = AudioSegment.from_wav(filename) @@ -121,7 +123,7 @@ with gr.Blocks() as interface: stop_button = gr.Button("Stop Recording") transcribe_button = gr.Button("Transcribe") - output = gr.Textbox(label="Output") + output = gr.Textbox(label="Output", show_label=True, show_copy_button=True) start_button.click(start_recording, outputs=output) stop_button.click(stop_recording, outputs=output)