ashutoshm2897 commited on
Commit
6e29ab5
1 Parent(s): a85ac8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,12 +1,14 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
3
 
4
  # Load the Whisper model and pipeline
5
  pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small")
6
 
7
- def transcribe(*args):#audio):
8
  """Transcribe the audio using the loaded Whisper pipeline."""
9
- text = pipe(args[0])["text"]#audio)["text"]
 
10
  return text
11
 
12
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ import numpy as np
4
 
5
  # Load the Whisper model and pipeline
6
  pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small")
7
 
8
+ def transcribe(audio):
9
  """Transcribe the audio using the loaded Whisper pipeline."""
10
+ audio_np = np.frombuffer(audio, dtype=np.int16)
11
+ text = pipe(audio_np)["text"]
12
  return text
13
 
14