aitor-medrano commited on
Commit
39f38cd
·
verified ·
1 Parent(s): 439eda0
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -3,8 +3,11 @@ import torch
3
  from transformers import pipeline
4
  import numpy as np
5
 
6
- pipe = pipeline(
7
- "automatic-speech-recognition", model="openai/whisper-base"
 
 
 
8
  )
9
 
10
  def greet(modelo, grabacion):
@@ -13,6 +16,11 @@ def greet(modelo, grabacion):
13
  y = y.astype(np.float32)
14
  y /= np.max(np.abs(y))
15
 
 
 
 
 
 
16
  return modelo + ":" + pipe({"sampling_rate": sr, "raw": y})["text"]
17
 
18
  demo = gr.Interface(fn=greet,
 
3
  from transformers import pipeline
4
  import numpy as np
5
 
6
+ pipe_base = pipeline(
7
+ "automatic-speech-recognition", model="aitor-medrano/whisper-base-lara"
8
+ )
9
+ pipe_small = pipeline(
10
+ "automatic-speech-recognition", model="aitor-medrano/whisper-small-lara"
11
  )
12
 
13
  def greet(modelo, grabacion):
 
16
  y = y.astype(np.float32)
17
  y /= np.max(np.abs(y))
18
 
19
+ if modelo == "Base":
20
+ pipe = pipe_base
21
+ else:
22
+ pipe = pipe_small
23
+
24
  return modelo + ":" + pipe({"sampling_rate": sr, "raw": y})["text"]
25
 
26
  demo = gr.Interface(fn=greet,