sergiolucero commited on
Commit
246edcb
1 Parent(s): 2553faa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,15 +1,13 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
  import numpy as np
4
-
5
- transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base")
6
 
7
  def transcribe(audio):
8
- sr, y = audio
9
- y = y.astype(np.float32)
10
- y /= np.max(np.abs(y))
11
 
12
- return transcriber({"sampling_rate": sr, "raw": y})["text"]
13
 
14
  gr.Label("Demo CORFO")
15
  demo = gr.Interface(
 
1
  import gradio as gr
2
  from transformers import pipeline
3
  import numpy as np
4
+ from ailib import whisper_transcribe
 
5
 
6
  def transcribe(audio):
7
+ filename = 'audio.wav'
8
+ open(filename, 'wb').write(audio)
9
+ return whisper_transcribe(filename)
10
 
 
11
 
12
  gr.Label("Demo CORFO")
13
  demo = gr.Interface(