Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,9 @@ import time
|
|
6 |
|
7 |
pipe_base = pipeline("automatic-speech-recognition", model="aitor-medrano/lara-base-pushed")
|
8 |
pipe_small = pipeline("automatic-speech-recognition", model="aitor-medrano/whisper-small-lara")
|
|
|
9 |
|
10 |
-
def greet(grabacion
|
11 |
-
|
12 |
inicio = time.time()
|
13 |
|
14 |
sr, y = grabacion
|
@@ -16,26 +16,22 @@ def greet(grabacion, modelo="base"):
|
|
16 |
y = y.astype(np.float32)
|
17 |
y /= np.max(np.abs(y))
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
modelo = "small"
|
23 |
-
pipe = pipe_small
|
24 |
|
25 |
-
result = modelo + ":" + pipe({"sampling_rate": sr, "raw": y})["text"]
|
26 |
fin = time.time()
|
27 |
|
28 |
-
return
|
29 |
|
30 |
demo = gr.Interface(fn=greet,
|
31 |
inputs=[
|
32 |
gr.Audio(),
|
33 |
-
gr.Dropdown(
|
34 |
-
["base", "small"], label="Modelo", info="Modelos de Lara entrenados"
|
35 |
-
)
|
36 |
],
|
37 |
outputs=[
|
38 |
-
gr.Text(label="Salida"),
|
|
|
|
|
39 |
gr.Number(label="Tiempo")
|
40 |
])
|
41 |
-
demo.launch()
|
|
|
6 |
|
7 |
pipe_base = pipeline("automatic-speech-recognition", model="aitor-medrano/lara-base-pushed")
|
8 |
pipe_small = pipeline("automatic-speech-recognition", model="aitor-medrano/whisper-small-lara")
|
9 |
+
pipe_base_2000 = pipeline("automatic-speech-recognition", model="aitor-medrano/whisper-base-lara-2000")
|
10 |
|
11 |
+
def greet(grabacion):
|
|
|
12 |
inicio = time.time()
|
13 |
|
14 |
sr, y = grabacion
|
|
|
16 |
y = y.astype(np.float32)
|
17 |
y /= np.max(np.abs(y))
|
18 |
|
19 |
+
result_base = "base:" + pipe_base({"sampling_rate": sr, "raw": y})["text"]
|
20 |
+
result_small = "small:" + pipe_small({"sampling_rate": sr, "raw": y})["text"]
|
21 |
+
result_base_2000 = "base_2000:" + pipe_base_2000({"sampling_rate": sr, "raw": y})["text"]
|
|
|
|
|
22 |
|
|
|
23 |
fin = time.time()
|
24 |
|
25 |
+
return result_base, result_small, result_base_2000, fin - inicio
|
26 |
|
27 |
demo = gr.Interface(fn=greet,
|
28 |
inputs=[
|
29 |
gr.Audio(),
|
|
|
|
|
|
|
30 |
],
|
31 |
outputs=[
|
32 |
+
gr.Text(label="Salida (Base)"),
|
33 |
+
gr.Text(label="Salida (Small)"),
|
34 |
+
gr.Text(label="Salida (Base 2000)"),
|
35 |
gr.Number(label="Tiempo")
|
36 |
])
|
37 |
+
demo.launch()
|