add copy button

This commit is contained in:
Christian Rute 2025-01-16 16:27:50 +01:00
parent 363397542e
commit 19145ca1a4

4
app.py
View File

@ -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)