add copy button
This commit is contained in:
parent
363397542e
commit
19145ca1a4
4
app.py
4
app.py
@ -71,11 +71,13 @@ def save_audio_to_wav(audio, filename):
|
|||||||
wf.setframerate(SAMPLE_RATE)
|
wf.setframerate(SAMPLE_RATE)
|
||||||
wf.writeframes(audio.tobytes())
|
wf.writeframes(audio.tobytes())
|
||||||
|
|
||||||
|
|
||||||
def get_audio_duration(filename):
|
def get_audio_duration(filename):
|
||||||
"""Returns the duration of the audio file in seconds."""
|
"""Returns the duration of the audio file in seconds."""
|
||||||
audio = AudioSegment.from_wav(filename)
|
audio = AudioSegment.from_wav(filename)
|
||||||
return len(audio) / 1000
|
return len(audio) / 1000
|
||||||
|
|
||||||
|
|
||||||
def split_audio(filename, chunk_length_ms=30000):
|
def split_audio(filename, chunk_length_ms=30000):
|
||||||
"""Splits an audio file into chunks."""
|
"""Splits an audio file into chunks."""
|
||||||
audio = AudioSegment.from_wav(filename)
|
audio = AudioSegment.from_wav(filename)
|
||||||
@ -121,7 +123,7 @@ with gr.Blocks() as interface:
|
|||||||
stop_button = gr.Button("Stop Recording")
|
stop_button = gr.Button("Stop Recording")
|
||||||
transcribe_button = gr.Button("Transcribe")
|
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)
|
start_button.click(start_recording, outputs=output)
|
||||||
stop_button.click(stop_recording, outputs=output)
|
stop_button.click(stop_recording, outputs=output)
|
||||||
|
Loading…
Reference in New Issue
Block a user