nekin12 commited on
Commit
55f0a8a
1 Parent(s): c730f13

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.es")
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
+ demo = gr.Interface(
15
+ transcribe,
16
+ gr.Audio(sources=["microphone"], type="numpy", label="xerra aqui..."),
17
+ "text",
18
+ )
19
+
20
+ demo.launch(debug=True)