sergiolucero commited on
Commit
52bf87c
1 Parent(s): 534e084

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -1,7 +1,22 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  demo.launch()
 
 
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(
16
+ transcribe,
17
+ gr.Audio(sources=["microphone"]),
18
+ "text",
19
+ )
20
 
 
21
  demo.launch()
22
+