Antoniskaraolis commited on
Commit
c575d84
·
1 Parent(s): 5046c96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,9 +1,13 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
3
 
4
  asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small")
 
5
  def transcribe(audio_file):
6
- transcription = asr_model(audio_file)
 
 
7
  return transcription["text"]
8
 
9
  iface = gr.Interface(
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ import soundfile as sf
4
 
5
  asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small")
6
+
7
  def transcribe(audio_file):
8
+ with audio_file as f:
9
+ data, samplerate = sf.read(f.name)
10
+ transcription = asr_model(data, samplerate=samplerate)
11
  return transcription["text"]
12
 
13
  iface = gr.Interface(