Anushkabhat9 commited on
Commit
7f99edb
·
verified ·
1 Parent(s): 0c00dfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -10,21 +10,20 @@ pipe = pipeline(
10
 
11
  # Define the transcription function for audio input
12
  def transcribe_audio(audio):
13
- # Transcribe the uploaded or recorded audio
14
  prediction = pipe(audio, batch_size=8, return_timestamps=True)["chunks"]
15
 
16
- # Format the output to show text with timestamps
17
  transcription = "\n".join([f"[{chunk['timestamp'][0]:.2f}s - {chunk['timestamp'][1]:.2f}s] {chunk['text']}" for chunk in prediction])
18
 
19
  return transcription
20
 
21
  # Create a Gradio interface
22
  interface = gr.Interface(
23
- fn=transcribe_audio, # The function to be applied to the audio input
24
- inputs=gr.Audio(type="filepath"), # Users can record or upload audio
25
- outputs="text", # The output is the transcription (text with timestamps)
26
- title="Whisper Small ASR", # Title of your app
27
- description="Upload or record audio for transcription using Whisper Small." # Description of your app
28
  )
29
 
30
  # Launch the Gradio app
 
10
 
11
  # Define the transcription function for audio input
12
  def transcribe_audio(audio):
13
+
14
  prediction = pipe(audio, batch_size=8, return_timestamps=True)["chunks"]
15
 
 
16
  transcription = "\n".join([f"[{chunk['timestamp'][0]:.2f}s - {chunk['timestamp'][1]:.2f}s] {chunk['text']}" for chunk in prediction])
17
 
18
  return transcription
19
 
20
  # Create a Gradio interface
21
  interface = gr.Interface(
22
+ fn=transcribe_audio,
23
+ inputs=gr.Audio(type="filepath"),
24
+ outputs="text",
25
+ title="Whisper Small ASR",
26
+ description="Upload or record audio for transcription using Whisper Small."
27
  )
28
 
29
  # Launch the Gradio app