YosefAyele commited on
Commit
fea87b1
·
1 Parent(s): a17627f

add sleep time before executing read audio file

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -4,6 +4,7 @@ from pydub import AudioSegment
4
  import os
5
  import numpy as np
6
  from scipy.io.wavfile import write
 
7
 
8
 
9
  # Load the ASR model
@@ -23,6 +24,7 @@ def transcribe_audio(audio_file):
23
  temp_audio_path = "temp_audio/input_audio.wav"
24
 
25
  # Convert audio to .wav format
 
26
  sound = AudioSegment.from_file(audio_file)
27
  sound.export(temp_audio_path, format="wav")
28
 
@@ -59,7 +61,7 @@ with gr.Blocks() as app:
59
  gr.Markdown("Upload or record an audio file in any format, and get its transcription.")
60
 
61
  with gr.Row():
62
- audio_input = gr.Audio(label="Upload or Record Audio", type="filepath")
63
  transcription_output = gr.Textbox(label="Transcription")
64
 
65
  transcribe_button = gr.Button("Transcribe")
 
4
  import os
5
  import numpy as np
6
  from scipy.io.wavfile import write
7
+ import time
8
 
9
 
10
  # Load the ASR model
 
24
  temp_audio_path = "temp_audio/input_audio.wav"
25
 
26
  # Convert audio to .wav format
27
+ time.sleep(5)
28
  sound = AudioSegment.from_file(audio_file)
29
  sound.export(temp_audio_path, format="wav")
30
 
 
61
  gr.Markdown("Upload or record an audio file in any format, and get its transcription.")
62
 
63
  with gr.Row():
64
+ audio_input = gr.Audio(label="Upload or Record Audio", type="filepath")
65
  transcription_output = gr.Textbox(label="Transcription")
66
 
67
  transcribe_button = gr.Button("Transcribe")